Unix Questions
By P. Conrad, for CISC474, Spring 2007
- 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.)
- 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?
- 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?
- Explain the purpose of the environment variables PATH, MANPATH, and LD_LIBRARY_PATH, CLASSPATH.
- Differentiate the purpose of each of these four. In particular, be very specific about the difference between PATH and CLASSPATH.
- What are the "startup files" used with the csh/tcsh shell and the bash shell?
- What is the role of these startup files?
- What is different about the composers in terms of startup files (hint: .localenv).
- 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.)
- In a shell script, what does $? indicate?
- 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."
- 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.
- Explain each of the following terms: cron job, crontab.
- Give an example of what you might use a cron job for in practice.
- When you put shell commands into a crontab, which shell is used to run that command (by default?)
- How can you change this default?