Last active
September 16, 2021 22:42
-
-
Save 0x1b-xyz/daeed35f1c65ecd59d342710f57560fb to your computer and use it in GitHub Desktop.
Bash header opts and reminder to declare for subshell assignments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail; shopt -s inherit_errexit | |
# Dont. | |
export MYVAR=$(exit 1) && echo "I'll run because bash is kind of unpredictable" | |
# Do. | |
declare MYVAR | |
MYVAR=$(exit 1) && echo "I wont run because ... well whatever." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment