Re: trap and exit status

From: Juergen Heck (btd.heck_at_t-online.de)
Date: 07/30/03


Date: Wed, 30 Jul 2003 17:20:56 +0200


Michael Wang schrieb:
>
> I wonder if there is a solution in ksh (88 or 93) for following spec:
>
> - setup exit and signal trap
> - retain the exit status as if no trap was set (exit status-128 or 256 is ok)
> - differentiate exit and signal trap, as they will perform different tasks
>
> Thanks.
> --
> Michael Wang * http://www.unixlabplus.com/ * mwang@unixlabplus.com

untested idea:

function exitfunc {
 ## exit-task
 rc=$1
 case $rc in ...

 esac
}

function sigintfunc {
 ## sigint-task
 rc=$1
 case $rc in ...

 esac
}
...

trap 'exitfunc $? ' EXIT
trap 'sigintfunc $? ' INT
trap ...

Regards
Juergen



Relevant Pages

  • Re: trap and exit status
    ... > - setup exit and signal trap ... > - differentiate exit and signal trap, as they will perform different tasks ... open source system monitoring and network monitoring software package. ...
    (comp.unix.shell)
  • Re: trap and exit status
    ... > - setup exit and signal trap ... > - differentiate exit and signal trap, as they will perform different tasks ... This was dealt with recently. ... A non-portable solution was posted here ...
    (comp.unix.shell)
  • trap and exit status
    ... I wonder if there is a solution in ksh for following spec: ... - setup exit and signal trap ... differentiate exit and signal trap, as they will perform different tasks ...
    (comp.unix.shell)