Jonathan Nieder dixit:

> $ sh -c 'trap "echo hi; exit" EXIT; exit 9'; echo $?
                 ^^^^        ^
This “exit” command above will return the errorlevel of the echo call.
I don’t believe I will change this, at first glance (it’s past mid-
night though, but now you can work on it).

This however works:

t...@blau:~ $ sh -c 'trap "x=\$?; echo hi; exit \$x" EXIT; exit 9'; echo $?
hi
9

The \ before the $ are because you use double quotes around trap;
in real shell code you’d write this instead:
        trap 'x=$?; echo hi; exit $x' EXIT

bye,
//mirabilos
-- 
16:47⎜«mika:#grml» .oO(mira ist einfach gut....)      23:22⎜«mikap:#grml»
mirabilos: und dein bootloader ist geil :)    23:29⎜«mikap:#grml» und ich
finds saugeil dass ich ein bsd zum booten mit grml hab, das muss ich dann
gleich mal auf usb-stick installieren   -- Michael Prokop über MirOS bsd4grml



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to