All pastes #34976 Raw Edit

Someone

public text v1 · immutable
#34976 ·published 2005-12-27 12:14 UTC
rendered paste body

# Get option.  If there are none replace the "?" that getopts puts in
# FLAG on error with "null".
getopts rdcavh FLAG
if [ "$?" -ne 0 ]; then
    FLAG="null"
fi
                                                                                                                              
# Check for additional options.  Should be none.
getopts :rdcavh DUMMY
if [ "$?" -eq 0 ]; then
    echo "$0: Illegal option -- ${OPTARG}."
    exit 1
fi
                                                                                                                              
case $FLAG in
 "r") SIG=HUP;  DONE=signalled; shift ;;
 "d") SIG=USR1; DONE=signalled; shift ;;
 "c") SIG=USR2; DONE=signalled; shift ;;
 "a") MODE="all"; shift ;;
 "v") echo "$0$Revision: 1.8 $_TrickToPrint_RCS_Revision"; exit 0 ;;
 "h") usage; exit 0 ;;
 "?") exit 1;
esac