This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
In this article, we’ll go over how to properly test exit codes in Bash scripts. Testing exit codes with $? When I first started writing Bash, I often wrote the following code to test whether a program’s execution was successful: 1some_command 2if [ '$?' -eq 0 ]; then 3 echo 'It worked!' 4fiHowever, this introduces complexity in the flow of the script. For example, one minor mistake…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.