• A bourne shell (sh) script is a list of lines in a file that are executed in the bourne shell (a forerunner of bash); simplest is just commands that could be run at the prompt.

  • The first line in a sh script MUST be   #!/bin/sh

  • Things to remember:
    • always make sure it has executable status
      chmod a+x filename
    • script runs in the current directory (pwd)
    • may not inherit the same environment - esp. if used by others

  • Example:
    bet im1 im1_brain -m
    mv im1_brain_mask.nii.gz mask1.nii.gz

  • A script can be stopped at any point by using return: e.g. return 0