------------------------ Week 8 Notes for CST8129 ------------------------ -Ian! D. Allen - idallen@idallen.ca *** Keep up on your readings (Course Outline: average 5 hours/week homework) Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Review of last week: Shell conditional programming exit_status.txt Return Code, Exit Status, test, if, and while - Unix commands return codes 0 to 255, with 0 meaning "success" - "exit 27" in a shell script will set the return code to 27 - shell IF and WHILE statements check return codes - the leading "!" operator complements any return code - use the "test" command (aliased as "[") to do arithmetic - "test" will also test pathname RWX and other attributes ---------- This week: ---------- Shell Variable and Command substitution: shell_variables.txt Shell Variables you should know (including $* and $@) command_substitution.txt Command Substitution - $(unix command) unix_shell.txt The Unix/Linux Shell (review $PATH in this file) - always double-quote your variables and command substitutions! - without double-quotes, the shell will re-expand the variable contents! Review Notes file unix_shell.txt for the use of $PATH. More shell conditional logic: quick_tests.txt Return Code, Exit Status, ||, &&, test, and if less_code.txt Less Code is Better Code - stop cutting and pasting deep_nesting.txt Avoiding deeply nested IF statements Sample shell scripts See the "Shell Scripts" section of the Course Notes for many sample shell scripts that demonstrate programming features. New commands: unix_command_list.txt Basic Unix/Linux Command List ---------------------- For next week (Week 9): ---------------------- Summary of shell script coding requirements: script_style.txt Shell Script Programming Conventions and Style script_checklist.txt Shell Script Checklist - things to verify Shell Input (reading from the user): shell_read.txt Reading stdin into shell variables - read, EOF, and exec Background info on scripting: character_sets.txt Collate Order and Character Set shell_script_execution.txt How a Shell Script is "Executed" links_and_inodes.html Hard links and Unix file system nodes (inodes) umask.txt Umask and Permissions Shell Shortcuts job_control.txt Shell background/foreground job control finding_files.txt Searching for and finding files by name Examples and Practice practiceTest2script.txt Practice Script #1 Specifications practiceTest2script.sh.txt Sample solution to practiceTest2script.txt practiceCommands_2.txt Practice Unix/Linux Questions #2 practiceCommands_3.txt Practice Unix/Linux Questions #3 * See the "Shell Scripts" section of the Course Notes for many * sample shell scripts that demonstrate programming features.