exec
Replaces the current process with a specified command. If no command is specified, the exec command spawns a new shell process and returns a shell prompt.
if
if <condition1> is met, do <commands1>; otherwise, if condition2 is met, do <commands2>; if neither is met, do <commands3>.</commands3></commands2></commands1></condition1>
read
Reads one line of standard input and assigns each word to the corresponding variable, with all leftowver words assigned to the last variable.
seq
Prints a sequence of numbers from FIRST to LAST, in steps of INCREMENT. Generally used in shell scripts.
test
Used with conditional constructs in shell scripts; test evaluates a condition and, if its value is true, returns a zero exit status; otherwise, returns a nonzero exit status.
while
while <condition> is met, do <commands>. <Condition> is usually specified with the test command.</Condition></commands></condition>
The bash script_file command can be used to directly execute a shell script.
True or False?
True
False
True
Which of the following is placed before a script name to execute it from the current directory?
!!
//
./
#!
./
What will the following command do (select all that apply):
read -p “Enter data> “ test
(choose two)
Work the same way as the type command
Print the input on local printer
Show a prompt along with blinking cursor
Store user input into a variable called test
Show a prompt along with blinking cursor
Store user input into a variable called test
The return status from a command is 1. What does this indicate?
Command executed successfully
Command did not execute successfully
Command is still running in the background
Calculation done by the command yields the result 1
Command did not execute successfully
The joanne user wants an email sent when her shell script is executed successfully. Which of the following commands in the script can do this?
cron job will send an email by default
echo $mail
mail root
mail joanne
mail joanne
What will the following statement do?
for name in cat /root/users
Run for two values; cat and /root/users
Get into an infinite loop
Assign to the name variable each value in the specified file
Report an error
Assign to the name variable each value in the specified file
The output of the command seq 10 10 30 will be:
10 20 30
10 10 30
3
50
10 20 30
The ___________ command is used to print a sequence of numbers.
series
list
seq
num
seq
The statement if [ -d file ] will be true, if the file:
Is executable
Exists
Is a directory
Is writable
Is a directory
Command substitution CAN NOT be used to insert the output of a command as another command’s argument.
False
True
False