mirror of https://github.com/tLDP/LDP
25 lines
504 B
Bash
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
|