eisai on Nostr: menherahair If that thing is to be sourced why in the world does it have a shebang, ...
menherahair (npub1n78…87ev) If that thing is to be sourced why in the world does it have a shebang, aaaaaa
Yeah, I agree, that it’s a bad idea to barge in with your stuff in the middle of works. And the reason why “set -e” didn’t work is difficult to figure out without seeing the description of die() and the shell options in the initial script, but some reasons may be speculated about:
- using ${var:-another_var} removes the possibility to catch an error here, as the “:-” operator is made exactly to avoid an empty variable triggering an error. A substitution to a string that happens to also be empty doesn’t count as an error (since instead of using a potentially empty value you use substitution, hence you must know what you’re doing)
- the “[[ -z "$*" ]] && die …” construction relies on “die” to perform exit with the “bad” code, since the logical expressions (&&, ||…) lift up the restriction imposed by “set -e”.
Which means that the pipefail never works, because inside the subshell (which is on the left side of the pipe) there’s never an error – thanks to ${…:-…} – and the check on the empty list of arguments (-z "$*") in _eval_user_sequence() is futile because of the logic expression (&&). The die() function should be doing the exit in this situation, but apparently, it cannot?
Yeah, I agree, that it’s a bad idea to barge in with your stuff in the middle of works. And the reason why “set -e” didn’t work is difficult to figure out without seeing the description of die() and the shell options in the initial script, but some reasons may be speculated about:
- using ${var:-another_var} removes the possibility to catch an error here, as the “:-” operator is made exactly to avoid an empty variable triggering an error. A substitution to a string that happens to also be empty doesn’t count as an error (since instead of using a potentially empty value you use substitution, hence you must know what you’re doing)
- the “[[ -z "$*" ]] && die …” construction relies on “die” to perform exit with the “bad” code, since the logical expressions (&&, ||…) lift up the restriction imposed by “set -e”.
Which means that the pipefail never works, because inside the subshell (which is on the left side of the pipe) there’s never an error – thanks to ${…:-…} – and the check on the empty list of arguments (-z "$*") in _eval_user_sequence() is futile because of the logic expression (&&). The die() function should be doing the exit in this situation, but apparently, it cannot?