# turn -x on if DEBUG is set to a non-empty string Oh and as long as you're messing with shell modes, -e goes well with -x (which I like to think of as shell X-ray). # I don't care if evil-broken-command fails If you REALLY want to ignore an error, be explicit about it: A neat predictable failure is infinitely better than a noisy unreliable failure. In this mode any command your script runs which returns a non-zero exitcode - an error in the world of shell - will cause your script to itself terminate immediately with an error. Turn on -e mode (do you feel lucky - punk?) Here are two simple tricks that are easy to use and will make your scripts much more robust. They just chug happily along even when everything is broken.īecause a lowly shell shell script doesn't need any error handling right? WRONG! Word on the street is your shell scripts don't do any error handling.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |