Multiple commands can be separated with a…?
;
Upon exiting, every command returns an integer to its parent called a…?
return value.
The shell variable $? expands to the return value of….?
previously executed command.
&& and || conditionally separate…?
multiple commands.
The bash shell allows users to easily run commands in a subshell, by…?
wrapping the command with parenthesis.
Why would someone want to run a command in a subshell?
Subshells are used to avoid side effects. What happens in the subshell should not effect the original shell’s environment (just as, in English, what happens in parenthesis should not change the surrounding sentence’s context).
The key to using Red Hat Enterprise Linux effectively is….?
automation.
A good Linux administrator should actually be extremely lazy when it comes to doing anything….?
boring or repetitive.
However, one important piece of your system administrator’s toolkit is still missing….?
scripting.
A script is, in its simplest form, just a text file with a…?
list of commands in it.
(The commands are sent through a specified program, called an interpreter, which runs each command in turn. Usually this interpreter will be the bash shell (referred to as /bin/bash or /bin/sh) and each command is an ordinary Linux command. Other interpreters allow you to use more powerful programming languages like Perl, Python and Ruby.)
Before you can begin writing scripts of your own, there are a few important things to remember:
Suppose you are an administrator who often needs to see which users are logged into the system. This information can be obtained by running the….?
w command (yes, that’s the whole thing) but, while this provides a nice summary of who is logged into the system, it does not print the time at which this snapshot of user activity was taken. Another command, called date prints out the current date and time, but no user information. If only you could combine those two commands into one….
Suppose you created a script called wdate.sh in your personal bin directory:
see https://academy.redhat.com/courses/rha030-6.1/rha030_bash_cmdlists.html for the example.
Every process in Linux has a…?
Lifespan.
All processes start at the request of another…?
process (often a shell)
The requesting process is referred to as the…?
parent, and the newly born process the child
Usually, the child process performs its duties (which might involve spawning children of its own), and then…?
elects to die.
An exiting process leaves a little piece of information behind when it dies, called the…?
process’s return value, or exit status.
The parent process is responsible for collecting the…?
return values of dead children.
Return values come in the form of integers which range from..?
0 to 255
Programs are free to choose what….?
value to return upon exiting
Often, what implications are meant by different return values are…?
part of a program’s well defined interface, and are documented in that program’s man page. (If you are familiar with the diff command, the “DIAGNOSTICS” section of its man page provides an example)
A Linux-wide (and Unix-wide) convention is that a program returns a…?
0 to imply “success” at whatever it was trying to accomplish, and a non zero return value to imply some form of failure.
The bash shell stores the return value of the previously executed command in a special variable called…?
simply ?
The bash shell uses && and || to…..?
join two commands conditionally