LDP/LDP/guide/docbook/abs-guide/hello.sh

25 lines
504 B
Bash

#!/bin/bash
# hello.sh: Saying "hello" or "goodbye"
#+ depending on how script is invoked.
# Make a link in current working directory ($PWD) to this script:
# ln -s hello.sh goodbye
# Now, try invoking this script both ways:
# ./hello.sh
# ./goodbye
HELLO_CALL=65
GOODBYE_CALL=66
if [ $0 = "./goodbye" ]
then
echo "Good-bye!"
# Some other goodbye-type commands, as appropriate.
exit $GOODBYE_CALL
fi
echo "Hello!"
# Some other hello-type commands, as appropriate.
exit $HELLO_CALL