Guide to UNIX Using Linux Fourth Edition
Chapter 7 Solutions
Answers to the Chapter 7 Review Questions
1. You have been asked to write a script for use by the faculty at the engineering school at your
college. The script you write uses the Bash shell, but some faculty members often use a different
shell in their work. How can you best ensure that the Bash shell is invoked when this script is run?
2. Which of the following script statements accomplishes the same thing as the statement: while [
“$part” != “alternator” ] ; do ? (Choose all that apply.)
3. Your shell script, called .filetests, contains several functions used to run tests on files, such as to
determine if a file is empty or has the correct permissions. Which of the following is/are true about
.filetests? (Choose all that apply.)
4. When you enter echo $CLR your screen clears very quickly. Which of the following commands
must you have entered previously to enable use of echo $CLR to clear the screen?
5. Your company has assigned you to revise 22 scripts. Since you use the vi editor, how can you set
it to automatically display lines as numbered so it is easier for you to work on these revisions?
6. You use the same five shell functions every day and are looking for a way to ensure they are
available as soon as you log into your account. What can you do??
7. When you enter test -d tmp ; echo $?, you see a 0 displayed on the screen. What does this mean?
8. What does a down arrow represent in a flowchart?
9. Which of the following are examples of Boolean operators used with the test command? (Choose
all that apply.)
10. You have a specialized data file, called customers in which the fields in the file are separated by
the character ^. You want to view this file with a colon between the fields before you convert it to
remove the ^ characters and insert colons. Which of the following commands enables you to view
the file in this way?
11. Which of the following statements enables you to determine if the variable, called value, is less
than 750?