#! /bin/sh # Question 3: # Write a script that prints an error message and exits if a lockfile # exists. A lockfile is a file in the /tmp directory, with a name # equal to the basename of the script, followed by the string, # ``.lock'' For example, if the name of the script is lockit, then the # name of the lockfile shall be /tmp/lockit.lock prog=$(basename $0) lockfile="/tmp/${prog}.lock" if [ -e "$lockfile" ] then echo "lockfile exists" exit 1 else echo "No existing lockfile" fi # just to help in testing: sleep 60