For example, following code is very common in scripts:
### CODE BEGIN ###
function debug
{
return
}
function runcmd
{
typeset cmd=$1
typeset rc
debug "+++ $cmd"
eval "$cmd"
rc=$?
if (( rc )); then
debug "+++ $cmd failed with $rc"
else
debug "+++ $cmd succeeded"
fi
return $rc
}
runcmd '/usr/bin/sleep 15'
echo $?
### CODE END ###
The problem is when the command is killed by a signal, we cannot return the
correct $? (> 256) from the runcmd() function. Bash does not has this
problem since $? is equal to 128+signal when a command is killed.
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users