LUX 211 - Shell Programming
Review for Second Test
The following questions are provided to help you study for the second
test. Do not expect to see these exact questions on the test.
- How would you load a function into RAM from a script?
- How can you remove a function frrom RAM once it is loaded?
- What is the basic structure of a function?
- How is a function called in a script?
- What set of symbols marks the body of a function?
- How can you end a function before you reach the last line in its body?
- How do you pass an argument to a function in a shell script?
- What are the two methods shown in chapter 8 to do math with a variable's
- Which of the two methods above is more likely to use a dollar sign?
- What is the purpose of the -p option for the read command? What is
the advantage of doing that?
- How do you use the test command to check whether two strings held
in variables are the same?
- What marks an equal sign as a conditional operator in a test command?
- Why is it illogical to have a structure that follows the form "if...then..fi"?
- What is the symbol that stands for the number of arguments passed
to the last command?
- What is the proper syntax to use in a test command that determines
whether two variables containing integers are equal?
- What command can be used to immediately stop running a script?
- What is the concept behind having the command in question 16 use a
- What is the meaning of elif? How many elifs are allowed in a single
structure that uses them?
- What is the troubleshooting value of starting a shell with the -x
- How does the for structure differ from the for...in
- What does the break command do when it is issued inside a loop?
- What does the continue command do when it is issued inside a loop?
- What are the file descriptors for stdin, stdout, and stderr?
- What is the value of $0 when a script starts running?
- What are the positional descriptors used for in a script or a function?
- Why are we warned to use double quotes around a reference to a positional
- How do we reference the exit code of the most recently ended process?
- What does the text mean when it says that shell variables are typically
- What makes a variable an environment variable?
- Can a process pass environment variables to a child process? Can the
child process change environment variables? Why is that answer complicated?
- How can we most simply load a series of words into an array?
- What is the first subscript in any array?
- What is the syntax to echo the value stored in a particular array
element/item/member? (Yes, those words mean the same thing in this context.)
- Can a function overwrite the value stored in a variable that was created
in the script that called the function? How can we prevent that from
- What is a builtin command? How is it handled differently from a command
strored in a /bin folder?
- Describe the two syntaxes for the let command discussed in chapter
- What is incrementation? What are the two versions of using the incrementation
- How does the shell interpret two commands separated by the &&
operator? What about the || operator?