Skip to content
Advertisement

How to redirect specific exit code into a file in bash [closed]

I currendtly have two if statements, each with a different exit code. How can I store these exit codes into a file?

JavaScript

Is there anyway to redirect these specific exit codes into a file in bash?

Advertisement

Answer

You can capture the exit code using the $? variable:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement