================ Script Checklist (to Chapter 10) -IAN! idallen@ncf.ca ================ This is a list of things to verify in your shell scripts: - script must start with a complete script header (interpreter, syntax, purpose, author, date, PATH, umask) - issue prompts before reading input - prompt messages must appear on stderr so they don't get redirected - note: some menus might also be considered as prompts - quote every use of a shell variable, and don't miss any - quote every use, every time, to prevent wildcard expansion - I mean every use, every time - I mean it - you might get away with not quoting $$, $#, and $?, but that's all - I *really* do mean it - use good programming style - avoid lines longer than 80 characters (break and continue long lines using a backslash to escape the newline) - add useful, helpful comments (not useless ones) in front of code blocks (don't comment in front of every single line) - use good variable names, related to your algorithm (don't copy the poor names used by your instructor in examples) - don't repeat code (parametrize your algorithm) - test your scripts with problematic input - try wildcards, blanks, dashes, punctuation, empty strings, EOF, etc. - try no command line arguments and then hundreds of arguments - try short inputs, medium inputs, and huge long inputs - look for unquoted variables and put wildcards in them and watch your script blow up, then fix it by quoting all your variables - no input should cause a shell script to generate an internal error