Examples of simple scripts



Last revision August 6, 2004

These are examples of some simple scripts that collect commands together in a script file to save having to type them every time they are needed.

/home/sysop/farrell/bin/atlookall on pangea

This script runs the atlook command, which searches specified AppleTalk network zones for devices, with a long list of zones applicable to Earth Sciences. Making a script saves having to type all those zone names every time you run it.

#! /bin/csh -f
# Run atlook to check all Earth Sciences AppleTalk zones.
# $* syntax inserts any options given as arguments to this
# script ahead of zone names.
# Backslashes at ends of lines continue the command to the next line.

atlook $* ES-Ethernet ES-Green-East ES-Green-West ES-Green-Concourse \
    ES-Mitchell-SB ES-Mitchell-B ES-Mitchell-1st ES-Mitchell-3rd \
    ES-Mitchell-4th ES-GeoCorner-1st ES-GeoCorner-2nd ES-GeoCorner-3rd

/local/bin/handcart on pangea

Typing the command handcart on pangea results in the execution of this script, which is stored in one of the standard system program directories. All the script does is print information about how to use the hardcart in the Mitchell Building.

#! /bin/csh -f
more << EOF
Combination for the combination lock on the
School of Earth Sciences hand cart:

Turn RIGHT at least three full turns, stop at 8
Turn LEFT 1.75 turns (turn past 8), stop at 38
Turn RIGHT, stop at 4, pull shackle

The cart is parked under the south stairwell
in the subbasement of the Mitchell Building.
Rules for use are posted nearby. Please
contact Felicia in the Dean's Office (723-5490)
for further help.
EOF

/local/bin/pine on pangea

In order to provide global options that will affect all runs of the pine email reader program on pangea, there is a simple script in the standard system program directory /local/bin that first makes the settings you want, and then calls the real pine program, which is stored under another name.

#! /bin/csh -f
#  Driver shell for the "pine" mail handling program.
#  P. Farrell, 30 April 1996
#
#  This allows me to set default options. Previously, I would
#  set the -z option to allow program suspension; but that is now
#  set in the /local/lib/pine.conf file. Unset the DISPLAY variable,
#  which pangea sets for all logins, whether X terminal or not,
#  so pine won't try to display MIME images on non-X terminals.
#  X logins can use name "pinex" to run the program directly.
#
unsetenv DISPLAY
#
#  The syntax $*:q will substitute the argument list exactly as
#  passed, with embedded blanks in words, escaped metacharacters
#  uninterpreted, etc. Verified by testing.
#
exec /local/bin/pine4.33 $*:q

Comments or Questions?