------------------------ Week 8 Notes for NET2003 ------------------------ -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Keep up on your readings (Course Outline: average 5 hours/week homework) Shell syntax: - define environment variables and call command, e.g. $ LC_COLLATE=en sort /usr/dict/words $ LC_COLLATE=C sort /usr/dict/words - variables set on the same command line as a command, before the command name, are set only in the environment of the command; they are not set locally - a quick way to pass in an environment variable without using "export" local variable x is not passed to environment (unless exported): $ x=foo $ echo var is $x var is foo $ bash bash$ echo var is $x var is bash$ exit $ echo var is $x var is foo environment variable y is set for one command (not set locally): $ echo var is $y var is $ y=foo bash bash$ echo var is $y var is foo bash$ exit $ echo var is $y var is shell "for" loop: for x in a b c d ; do echo $x ; done - can use any shell technique to generate the list a b c d - e.g. glob pattern: see /etc/init.d/httpd special forms of shell script redirection apply to rest of script exec 2>&1 exec