Re: trap and exit status
From: Juergen Heck (btd.heck_at_t-online.de)
Date: 07/30/03
- Next message: Kevin Rodgers: "Re: How many lines allowed in crontab, if any?"
- Previous message: Joe Halpin: "Re: pls need some guidance"
- In reply to: Ben: "Re: trap and exit status"
- Next in thread: Ben: "Re: trap and exit status"
- Reply: Ben: "Re: trap and exit status"
- Reply: Michael Wang: "Re: trap and exit status"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jul 2003 20:15:27 +0200
Ben wrote:
>
> Juergen Heck wrote:
> > trap 'exitfunc $? ' EXIT
> > trap 'sigintfunc $? ' INT
> > trap ...
>
> Should always return 0.
Example:
$ cat show1.ksh
#! /bin/ksh
function exitfunc { echo retcode of last cmd: $1 ; }
trap 'exitfunc $? ' EXIT
false
$ ./show2.ksh
retcode of last cmd: 1
$ cat show2.ksh
#! /bin/ksh
function exitfunc { echo retcode of last cmd: $1 ; }
trap 'exitfunc $? ' EXIT
true
$ ./show2.ksh
retcode of last cmd: 0
Regards
Juergen
- Next message: Kevin Rodgers: "Re: How many lines allowed in crontab, if any?"
- Previous message: Joe Halpin: "Re: pls need some guidance"
- In reply to: Ben: "Re: trap and exit status"
- Next in thread: Ben: "Re: trap and exit status"
- Reply: Ben: "Re: trap and exit status"
- Reply: Michael Wang: "Re: trap and exit status"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|