ITS 2310

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.

  1. Chapter 9 described writing scripts in Perl. How is a simple Perl script different from the simplest shell script?
  2. What is a sigil, with regard to Perl variables?
  3. 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?
  4. Compare writing a script in Perl to writing a bash script. Harder, easier, stranger, something else?
  5. What is the env shell command for? Give an example of how you might use it.
  6. What are shell variables? How are they different from variables created when the a shell is launched?
  7. What is the difference between using single quotes and double quotes in a shell script? When would it matter?
  8. When must you use accents grave/back quotes to get a desired effect?
  9. In the body of a shell script, what would $0, $1, and $2 refer to?
  10. 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?
  11. What variable holds the value that the read command cares about regarding field separators?
  12. How do you tell awk what character is the field separator in a data file?
  13. In the following example
    exec {apple}<"./orange"
    what is the name of file being opened? What is the name of the file descriptor?
  14. How do you use exec to close a file?
  15. What is the scope of a shell script variable? What does this mean, regarding the use of such variables?
  16. 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?
  17. 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?
  18. 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?