exit codes history
How do I access the history of the $? variable?
I know that $? returns the exit codes of the LAST executed program in your session, but is there a way to access the history of this variable such as during a pipelined set of commands in BASH and/or PERL? This would be especially useful when piping the output of your command through a grep, then testing the exit status of the original command--not grep's exit status.
I ran into this problem while writing a perl script that incorporates an rsync command.
I understand that--programmatically with perl and/or bash--there is surely a way around this without the pipe, but I still want to know if there is a way to glimpse into the history of exit statues with the $? variable outside of this particular situation.
Thanks in advance!
There is no history of exit status codes.
Bash has a array of exit status codes for a pipeline. See PIPESTATUS in man bash. Otherwise, the exit status is the status of the last command of the pipeline.
|All times are GMT -5. The time now is 12:56 AM.|