Tips on Writing Shell Scripts

  1. Use "stepwise refinement", which means to work on your program in steps. Make sure each part is well tested before moving on to the next step.

  2. Play around at the command-line before updating your code.

  3. It is a good idea to have 2 command-line windows open - one where you are working in vi and another where you are playing around with commands and testing your script.
  4. Use command-line editing.
  5. You can also execute a command while you are in vi with !.