I have a bash script called unions.sh:
_show_help ()
{
echo "$0 [-t time]"
echo
echo "-CARD [num]"
echo " card number"
echo
exit 0
}
_cleanup ()
{
echo Cleaning Up..
exit 5
}
trap _cleanup 0 1 2 5 6
until [ -z "$1" ]
do
case "$1" in
"--CARD")
shift
if [ -z "$1" ]; then
_fatal_error "--CARD must have an argument"
fi
_card="$1"
;;
"-h"|"--help")
_show_help
;;
esac
shift
done
When I ran ./unions.sh -h the output was
./unions.sh [-t time]
-CARD [num]
card number
Cleaning Up..
I have a doubt here. when I used the exit in the help function it called the _cleanup function. I have the same exit in the _cleanup function. Why that should not again call the _cleanup function?