------------------------------------------------ Linux Shells by Example: Chapter 1 Reading Guide ------------------------------------------------ -IAN! idallen@ncf.ca Here is a reading guide and some review questions for Chapter 1 "Introduction to Linux Shells". (You already answered most of these questions; most of this guide is copied from the Week 2 notes file.) *) What are "tokens" to a shell? What delimits tokens on a command line? *) Does a shell script need to be compiled first? *) True or False: the shell verifies your password at login. *) Where does the shell search for a command name? *) Which happens first, quote processing or variable substitution? *) If there is an alias named "foo" and an executable program named "foo", which will be executed by the shell? *) What is a process? *) What is a "system call"? Name the three major system calls used by shells to run commands. *) What is the "fork" system call? "exec"? "wait"? "exit"? Match them to these descriptions: ?) overlays the current process with another program ?) suspends processing until a child process finishes ?) duplicates the memory of the current process (makes 2 processes) ?) causes the current process to terminate *) Name some things in the shell "environment" that are passed to child processes. *) What is your process "umask"? How is it used? Is it passed to child processes? *) Before the umask is applied, what default permissions would be given to a new directory? to a new file? *) If you create a new file, change your umask, and then copy an existing file onto the new file, what happens to the permissions of the new file? *) How do octal permission numbers (e.g. 755) relate to rwx style permissions? How do you express "chmod 755 foo" using symbolic (letter) permissions? How do you express "chmod u=r,g=w,o=x foo" using octal permission numbers? *) Can ordinary users (non-root, non-super-user) use the "chown" command? *) What is your "working directory"? *) What is the difference between your home directory and the Unix directory that has the name "/home"? *) If a child changes directory, does it affect the directory of the parent process too? *) What is the difference between a local and an environment variable? *) If a child changes an environment variable, does it affect the variable in the parent process too? *) What are "stdin", "stdout", and "stderr"? To what are these attached when you first log in and get a shell prompt? *) What is "redirection"? Can I redirect stdout and stderr separately? *) What is a "pipe"? *) Explain the difference (if any) between these command lines: $ date | wc $ date > wc $ date < wc *) What do most "signals" do to a process? [the book is wrong about signal 0 on p.29 - see the textErrata.txt file] NOTE: Signal numbers and names may change from one version of Unix to another, especially signal numbers above 15. Don't memorize them. Most Unix systems agree on these numbers: HUP INT QUIT KILL and TERM *) What key sequence usually generates a SIGINT (interrupt) signal? *) What key sequence usually stops a process (SIGTSTP), so that it can be restarted later using "bg" or "fg"? *) What is a shell script? How do you create one? *) True or False: The VI editor automatically makes shell scripts executable when you write them out. *) True or False: You can always execute a script named "foo" by just typing "foo" at the shell prompt. *) True or False: The first line of every shell script should contain the absolute pathname to the shell that will interpret the script, e.g. #!/bin/bash or #!/bin/csh, etc.