bash-errors
Permalink: https://wizardzines.com/comics/bash-errors/
7 comments
@b0rk_reruns So you can do unzip fle.zip && cat file1 and if it can't unzip that file because it doesn't exist, then it won't run that cat command. @b0rk_reruns @indigoparadox There are some added rules about conditional dispatch for set -e, but they themselves perserve the general hackiness of bash.
@b0rk_reruns @b0rk_reruns if you're scripting rather than tapping raw bash into the terminal, this should give the same behaviour "#!/bin/bash -e -u -o" @patterfloof @b0rk_reruns No, you can only put one option on a #! line. I'm not sure whether the kernel will ignore the second two options or whether it will pass "-e -u -o" to bash as a single argv element with internal spaces, but either way it won't do what you wanted. |
@b0rk_reruns @b0rk grep won't succeed in that example unless curl's standard output matches that pattern, which is unlikely if curl failed. However, without
pipefail
or referencing${PIPESTATUS[0]}
for curl's exit code, you won't know if curl failed or if its lack of pandas caused grep to fail.