Unix Bass Unit 3-1 Review
What special character represents 0 or more characters on the Bash shell command line?
*
Under Bash shell, the following command creates a user-defined shell variable, called name, and initializes it to John Doe:
All of the above, which is: export name="John Doe" name= 'John Doe' name= "John Doe"
BASH is an acronym for:
Bourne Again Shell
What does &> accomplish when entered on the command line after a command?
It redirects both stderr and stdout to the same location.
What is the symbol that creates a pipe between commands?
The pipe ( | ) character but it is not one of your choices.
For each command that can be manipulated by the BASH shell, which of the following are valid file descriptors?
The three file descriptors are stdin, stdout, and stderr.
The sed and awk commands are filter commands commonly used to format data within a pipe?
True
What command will create an alias name dir which will execute the "ls -al" command?
alias dir='ls -al'
Which of the following will display the message "welcome home" if the cd /home/user1 command is successfully executed?
cd /home/user1 && echo "welcome home"
How do double quotation marks (") differ from single quotation marks (') affect expansion on the command line?
double quotations permit variable and parameter expansion while single quotations suppress all expansions.
Variables "name" and "place" can be made constant by:
readonly
Under Bash Shell, the command: echo The current date is `date` creates:
screen output with the current date displayed.
Under the Bash Shell the command: cat myaliases > ronsaka 2> errors will:
sends any error messages to file "errors" redirects stdout to file "ronsaka" create the file "ronsaka" even if file "myaliases" does not exist. (all of the above)
Which command could you use to see a list of all environment and user-defined shell variables as well as their current values.
set
Which of the following files is always executed immediately after any user logs in to a Linux system and receives a BASH shell?
/etc/profile
What is the character used to separate elements on the Linux command line?
All of the abovespaces, newlines, and tabs
The names of the common shell programs in UNIX are:
Bourne, Korn, and C shells
Under Bash Shell, the command: city=Los Angeles
Creates a user-defined variables city and initializes it to Los, and tries to execute Angeles as a command.
Which command can be used to display the value of a specific variable?
Echo
After executing the following command: ls /etc/hosts /etc/h 2>badoutput What will be the contents of badoutput?
Error messages generated by the command, if any.
Because stderr and stdout represent the results of a command and stdin represents the input required for a command, only stderr and stdout can be redirected to/from a file.
False
Under Bash shell, the command: export place=Austin
Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell
What is the difference in output between these two command: echo The working directory is `pwd` echo The working directory is $(pwd)
No difference
Under Bash shell, the environment variable PATH contains the absolute pathnames of:
PATH contains the seach path through a list of directories the shell uses to locate commands.
The Bash Shell command to create variable: "SUM" and assign "0" to it is:
SUM=0
Both aliases and functions can be used to store commands that can be executed, but functions also accept positional parameters.
True
What would be the effect of using the alias command to make an alias for the date command named "cat" in honor or your favorite pet?
When you use the cat command at the command prompt with the intention of viewing a text file, the date appears instead.
If your search path does not include the path to a particular shell file, and you try to run that shell file by typing its name on the command line, what happens?
You will get an error message of "command not found"..
Under Bash shell, the environment variable HOME contains the absolute pathname of:
Your home directory
When interpreting your commands, the shell assumes the first word you type on the command line is
a command name
Which of the following commands will declare file descripter 2 (stderr) to be a dupblicate of file descripter 1 (stdout) and sends both to the tr command?
cat myfile names |& tr "[a-z]" "[A-Z]"
The current value for the HOME variable is displayed by which of the following commands?
echo $HOME
Before a user-defined variable can be used by processes that run in subshells, that variable must be ____________.
exported
The error message: "permission denied" occurs when:
file name entered at the shell prompt is not executable.
What is the difference between a shell function and a shell script?
functions are stored in RAM while scripts are stored on disk. functions are preprocessed (parsed) so they start more quickly than a shell script. functions are executed in the shell that calls it; while, scripts are executed in a subprocess. All of the above
What command displays commands from the history list?
history
Under Bash shell, the command: export CDPATH=$HOME:$HOME/MyFiles causes:
the cd command to search the HOME directory the cd command to search the MyFiles directory (under the HOME directory) the cd command to search the working directory all of the above
The list of directories stored in the PATH variable is known as
the search path.
What command removes the variable "name" that has been created in a shell?
unset name
The command: echo \$person
will display the string: "$person"