Unix Questions

By P. Conrad, for CISC474, Spring 2007

  1. Four examples of login shells are sh, csh, tcsh and bash. Give a brief explanation of each—what distinguishes it from the other three. (I'm not looking for a long explanation—one or two sentences about each will suffice, as long as they are specific and clearly differentiate the four shells.)
  2. Why should every reasonable person use either tcsh or bash rather than csh, or sh, as their default login shell? How can you tell which login shell a particular user is currently using? And, what is the technique for changing your default login shell on the composers (i.e. strauss, copland?) What about on the ACAD systems?
  3. What is an environment variable? How do you set an environment variable (a) in a csh/tcsh startup file (b) in a bash startup file?
  4. Explain the purpose of the environment variables PATH, MANPATH, and LD_LIBRARY_PATH, CLASSPATH.
  5. What are the "startup files" used with the csh/tcsh shell and the bash shell?
  6. What is a shell script? Write a brief "hello world" type example illustrating the use of a shell script, using the Bourne Shell (not the Bourne Again Shell.)
  7. In a shell script, what does $? indicate?
  8. Give an example of both the csh/tcsh start up file syntax and the bash startup file syntax to do the following. "Check whether the directory /usr/jdk1.5 exists and is readable, and if so, append /usr/jdk1.5/bin to the current definition of the PATH environment variable, and append /usr/jdk1.5/man to the current definition of the MANPATH environment variable."
  9. If your startup files are messed up on the composers, the script ~consult/proto/setup may be useful. Look at this script, and explain what it does, and when you might need to use it.
  10. Explain each of the following terms: cron job, crontab.