Chapter 7 Quiz
Any command that can be executed on the command line can also be placed inside any environment file. a)True b)False
a)true
What number represents the stdin file descriptor? a)2 b)0 c)1 d)3
b)0
Given the syntax command && command, the command on the left of the && construct is executed only if the command on the right of the && construct completed successfully. a)True b)False
b)false
You are limited to using one pipe | metacharacter on the command line to pipe information from one command to another command. a)True b)False
b)false
The environment variables that are set by default and their current values can be viewed with what command? a)setenv b)set c)env d)get
b)set
What operator below is known as the NOT operator? a)-o b)% c)! d)-a
c)!
A list of all exported environment and user-defined variables in a shell can be viewed with what command below? a)set b)setenv c)env d)getenv
c)env
In order to redirect a file to the standard input of a command, what metacharacter should be used? a)> b)# c)| d)<
d)<
What construct is intended for use in processing a list of objects, such as files, directories, users, printers, and so on? a)case b)switch c)while d)for
d)for
You can use the sed command to remove unwanted lines of text. a)True b)False
a)true
What number represents the stderr file descriptor? a)2 b)3 c)0 d)1
a)2
Select the test statement that can be used to determine if A is numerically greater than B: a)[ A +eq B ] b)[ A -ge B ] c)[ A -g B ] d)[ A -gt B ]
a)[ A +eq B ]
The default BASH shell prompt is set by an environment variable. What command can be used to view this variable? a)echo $PS1 b)ls $PWD c)echo #PWD d)ls #PS1
a)echo $PS1
What permissions are required to execute a shell script in a manner similar to any other executable program on the system? a)read and execute b)execute c)read d)write and read
a)read and execute
Which command can be used to count the number lines, words, and characters in a file? a)wc b)tr c)pr d)nl
a)wc
Select the metacharacter that can be used to send the standard output of one command to another command as standard input: a)| b)> c)# d)<
a)|
What character combination at the start of a shell script are referred to as a hashpling, and allow for the specification of the shell that interprets the contents of the script? a)@! b)#! c)// d)->
b)#!
What environment file is always executed immediately after login for all users on the system, and sets most environment variables, such as HOME and PATH? a)˜/.bash_profile b)/etc/profile c)˜/.profile d)˜/.bash_login
b)/etc/profile
The standard output and standard error from a terminal screen within the BASH shell can be redirected to a file on the filesystem using what shell metacharacter, followed by the absolute or relative pathname of the file? a)| b)> c)# d)<
b)>
To prevent a file from being cleared by the BASH shell and append output to the existing output, you can specify three > metacharacters alongside the file descriptor. a)True b)False
b)false