Writing shell scripts

Besides interpreting commands typed in at the keyboard, the shell will also obey commands contained in a file. Such a file of commands is called a shell script.

Example

#!/bin/csh
# This script displays info about a file
# It accepts one parameter, the file name
ls -l $1
wc -l $1
file $1

If the above script were in a file called fi, then the command fi fred would print information about the file called fred.