SCRIPTING TIPS

Here are some basic, but useful, tips for writing scripts
  • Put in comments (to jog your memory when you write your paper months/years later)

  • Put in some echo output commands so that you get some feedback on what your script is doing as it runs

  • If your script starts doing something bad (or nothing at all) then use control-C to stop it

  • If your script makes new files, changes files or deletes files then start with a version which uses echo in front of the important commands. When you run this version it will just display the commands to the screen so that you can examine them carefully and make sure they are right. Once you are happy with them then remove the echo from in front of these commands and run this version.

  • It doesn't hurt to make a backup of key files before running a script, just in case.