On Mon, Feb 07, 2011 at 02:34:20AM -0800, अमेय साठे wrote:
> 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;;  

Why don't you place the error message here at exit itself? (or put the
message in a function and call it from here?)

traps are for capturing asynchronous events received by the process.

> esac
> fi
> }

_______________________________________
Pune GNU/Linux Users Group Mailing List 

Reply via email to