Chapter 7: working with the Bash Shell Study Guide
env
A list of all exported environment and user-defined variables in a shell can be viewed with what command below?
\f
Select the escape sequence that is used for a form of feed?
[A -gt B]
Select the test statement that can be used to determine if A is numerically greater than B?
awk
The ability to extract,manipulate,and format text using pattern action statements belong to which command below?
>
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?
colon
What character is used to delimit most Linux configuration files?
!
What operator below is known as the not operator?
When you use the cat command at the command prompt with the intention of viewing a text file, the date appears instead.
What would be the effect of using the alias command to make an alias for the date command named cat in honor of your favorite pet?
cd /home/user1 && echo "welcome home"
Which of the following will display the message welcome home if the cd /home/user1 command is successfully executed?
exported
Before a user-defined variable can be used by processes that run in subshells, that variable must be
<
In order to redirect a file to the standard input of a command, what metacharacter should be used?
\n
Select the escape sequence that starts a new line when used with echo:
|
Select the metacharacter that can be used to send the standard output of one command to another command as standard input?
echo ~ Correct! echo $HOME
The current value for the HOME variable is displayed by which of the following commands?
echo $PS1
The default BASH SHELL prompt is set by an environment variable. What command can be used to view this variable?
set
The environment variables that are set by default and their current values can be viewed with which command?
#!
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?
tr
What command can be used to replace characters in a file sent via standard input?
for
What construct is intended for use in processing a list of objects, such as files, directories, users, printers, and so on?
It appends Standard Output to a file.
What does >> accomplish when entered on the command line after a command?
/etc/profile
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?
Nothing is wrong with the command.
What is wrong with the following command string ls /etc/hosts >listofhostfile?
2
What number represents the stderr file descriptor?
0
What number represents the stdin file descriptor?
Read & Execute
What permissions are required to execute a shell script in a manner similar to any other executable program on the system?
WC
Which command can be used to count the number lines, words, and characters in a file?
set
Which command could you use to see a list of environment and user-defined shell variables as their current values?
1
Which of the following file descriptor numbers represents stdout?
Standard Input Standard Deviation
Which of the following is not necessarily generated by every command on the system?
You did not append the Standard Error to the Error file and as a result, it was overwritten when the command was run a second time.
You have redirected Standard Error to a file called Errors. You view the contents of this file afterward and notice that there are six error messages. After repeating the procedure, you notice that there are only two error messages in this file. Why?
