c - How to create a program that reads the last commands exit status? -
In Linux C, how can you read the exit status from the last programs
For example:
true; $ Echo?
Will show 0 for success. But I want to replace it with a C program:
true; ./echo_exit_status
How / where the final exit code is $? Is C program available?
The exit command is not accessible for the last command executed later In the program (absent horrifying hacking - associated with parent shell with debugger or somatoscope).
You can write a shell function or a helper that exports this value to the environment - but no solution is possible for which the shell's involvement is not required.
Comments
Post a Comment