---------------------------------------------- DAT2330 - Unix - Winter 2000 - Prof. Ian Allen ---------------------------------------------- Here are questions you should be able to answer. You will likely find questions similar to these on tests and exams. Chapter 5 - The Shell. Omit material that uses the line printer commands, e.g. "lpr". - True or False: These two command lines are equivalent: $ ls -l -i -d $ ls -lid - True or False: Every Unix command that takes several option letters lets you group them into a single argument starting with one hyphen. - True or False: To find commands to run, the shell looks in every system directory on the machine. - True or False: You cannot change the places where the SHELL looks to find commands; the locations are built into the Unix system. - Find the Unix pathname of the terminal with which you are connected to Unix (text p.95). Echo something and redirect the output into this pathname. Where does the output appear? Copy a short file onto this pathname using the "cp" command. Where does the output appear? - Study the differences between text figures 5-3, 5-5, and 5-8. Is it possible to redirect both the standard input *AND* the standard output of a Unix command at the same time? Give an example, if this is possible. - Go to the web site for the author and this textbook and find the correction to be applied to Figure 5-9. (The web site is mentioned in the intoductory pages.) - Study the box on page 99 and understand what the shell is doing when you redirect output! - What does "noclobber" mean? - What prompt does the shell use to remind you that you are operating as the Super User on a Unix system? - On page 101 the text says that a pipe is identical to redirecting the output of one command into a file, then running a second command and feeding it the file as standard input. While this is a true statement for pipes used in DOS, it isn't quite true under Unix. Unix pipes start passing data before the first command has finished; unlike DOS, you don't have to generate the full output of the first command before any output starts appearing on the input of the second command. Unix starts passing output as soon as it is available: $ cat -n -u | tr a-z A-Z abcd 1 ABCD hello 2 HELLO ^D $ Note how each line passes all the way through the pipe as it is typed. (What do the two options to "cat" mean?) - To put a sequence of shell commands into the background, enclose the sequence in parentheses before appending the ampersand: bash$ ( sleep 5 ; date ) & [1] 50070 bash$ ( sleep 5 ; echo "Hello there" | write abcd0005 ) & [2] 50085 - Understand the use of the wildcard (glob) characters: * ? [] - Will the "echo" command still work if you set your PATH variable to be empty? $ PATH='' $ echo "Does this work?" Explain the results. Now try "ls" and "date". Now try "/bin/ls" and "/bin/date". - Chapter non-Advanced Review Questions: On ACADAIX or Linux: 1 - 9 (all) - Chapter Advanced Review Questions: On ACADAIX or Linux: 10, 11, 12, 13, 14, 15, 16