Lecture 0 - PATH, basic scripts, editor -------------------------------------- Check your $PATH for ~/bin. echo $PATH How to add to your $PATH. (How to add to .bashrc) How to write a script. (#!/path/to/interpreter) How to mark your scripts executable. (chmod +x /path/to/script or chmod +x /path/to/*) Let's do a couple versions of "Hello World" a. Hello World! b. Hello David L. Willson, You're the $world to me! c. Who are you again? Oh! Hello ___, You're the $world to me! Lecture 1 - Bash Stuph ---------------------- history history $HISTSIZE $HISTFILESIZE $HISTTIMEFORMAT +r ^that^this !!, !123, !string chaining ; && || pipelining and redirection | > >> < 2>&1 command-output-nesting $( ) <- These are nestable e.g.: for i in $( seq $( get_start_num ) 100 ) `` <- This form is archaic, but be aware of it brace expansion {this,that,theotherthing} escaping special characters and line-continuation \ = escape char in front of any special-char, suppresses meaning long\ filename = "long filename" echo this long\ line completion tab tab-tab progs, files, vars, etc... Lecture 1 - internal and external utilities ------------------------------------------- ls -al, -R, -d, -F, -ltr test [] -eq -f -d sort -n -r grep -E -v awk/sed/perl cut -d -f tr -s -d echo -e -n '' = hard quotes do not allow interpretation "" = soft quotes allow interpretation \n = newline \t = tab Lab 1 ----- Use echo to build a table of names and email addresses, as shown. echo -e "me\tme@my.com\nyou\tyou@your.com\nhim\thim@his.com Change the last line to suppress interpretation of special characters. Use sed to replace the word needle with noodle, as shown. Use cut and sort to show the list of users on your system. looping and branching if (); then ...; elif (); then ... ; else ... ;fi while (); do ...; done for var in (space-delimited-list); do ...; done sub-shells and compound expressions () = sub-shell {} = compound statement environment, arguments, and other variables $@ and $* = whole command line, two ways $? = exit status of last $0 = name of program, as called $1, etc = arguments to program $# = number of arguments Lab 2 ----- Lecture 3 --------- regular expressions erroring and logging bash -eux (look up eq options) Last Lab --------