Review for Final Exam
The following questions are provided to help you study for the
final. Do not expect to see these exact questions on the test.
- Chapter 9 described writing scripts in Perl. How is a simple
Perl script different from the simplest shell script?
- What is a sigil, with regard to Perl variables?
- In a Perl script, you can assume that a scalar variable has a
value of zero when it is first created. How is this different
from C or C++? How did the example loop I showed you increment
the value of its line counter?
- Compare writing a script in Perl to writing a bash script.
Harder, easier, stranger, something else?
- What is the env shell command for? Give an
example of how you might use it.
- What are shell variables? How are they different from
variables created when the a shell is launched?
- What is the difference between using single quotes and double
quotes in a shell script? When would it matter?
- When must you use accents grave/back quotes to get a desired
- In the body of a shell script, what would $0, $1, and $2 refer
- How can you add your current working directory to the list of
directories that are searched for executables? Why would you do
that? How can you manually tell the OS to execute a script in
the current directory?
- What variable holds the value that the read command
cares about regarding field separators?
- How do you tell awk what character is the
field separator in a data file?
- In the following example
what is the name of file being opened? What is the name of the
- How do you use exec to close a file?
- What is the scope of a shell script variable? What does this
mean, regarding the use of such variables?
- What sorts of data should you expect to find in the
/etc/passwd file? What should you especially NOT expect to find
in it? What is the field delimiter in that file?
- When you write a new shell script, what must you do for users
to be able to run the script, assuming they can find it?
- Why do some script commands use piping and some use
redirection? What is the purpose of each technique? Why would
using the wrong one cause a command to fail?