[PLUG] Bash 'trap' command doesnt execute on SIGUSR1

अमेय साठे aakreet40-plug at yahoo.com
Mon Feb 7 16:04:20 IST 2011


Hi,
In the following bash code snippet; my main aim is to throw a string 'Unhandled exception occurred' using trap command. The command should capture 'exit 30' command. But; it is unable to do so.
trap  'echo " Unhandled condition occurred "' SIGUSR1
testdir()
{
dir="$@"
if  [ ! -d $dir ]
    then
case "$dir" in
  "/tmp/logdir" ) mkdir $dir ;;
  "$HOME/s3sync" ) echo "s3sync is not installed." ;;
  * ) echo "In function ${FUNCNAME} at $LINENO " 
          exit 30;;  
esac
fi
}

With Warm Regards,

Ameya Sathe

Blog: http://www.linuxquestions.org/blog/mr.-ameya-sathe-352399/








More information about the Plug-mail mailing list