I agree with you. I should add a disclaimer that this is still being worked on.
I will add what you proposed.
Thanks for your input.
I will add what you proposed.
Thanks for your input.
set -e
You'll never regret it and might be very very very happy it was there. And if you start with that, then as you work on the shell script, you'll be more likely to make the script be idempotent (checking for files before copying, checking for lines in files before appending/sed'ing etc.) Idempotent >> non-idempotent for "alter the state on an end point" things.
#!/bin/bash
set -e
(
echo "Start of Subshell"
(exit 1)
echo "This shouldn’t run, right?"
) || echo "Subshell failed"http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
(You can always turn, for example, error checking back off for an individual portion of the script with `set +e`) for name in "${names[@]}"; do
echo "$name"
done
The will not result in a single element, but will destructure each element of names, as if each were double-quoted, and will print the same output that the "strict mode IFS setting" does.What's more, the double-quoted array solution will work even if the elements contain newlines or tabs.