Hi:) Well this is my first thread in this community so forgive me if I make any mistakes.:)
I wrote 2 scripts ; "mycommand" and "traptest" as below.
#!/bin/bash
#mycommand
calledprg=
while [ "$1" != "" ]; do
case $1 in
-s ) shift
calledprg=$1
;;
* ) exit 1
esac
shift
done
if [ "$calledprg" != "" ];then
pkill -s 1 $calledprg
fi
exit
#!/bin/bash
#traptest
PROGNAME=$(basename $0)
echo "$PROGNAME"
trap ' echo "byeeeeeeeeeee" ; exit ' SIGHUP
mycommand -s $PROGNAME
while :
do
echo "sleeeeppppp"
sleep 60
done
but traptest never gets out of the loop even I want it to exit when mycommand sends it a signal.If you have any ideas about the problem I would be so happy to hear them:)) Thank u:)