Skip to content

Instantly share code, notes, and snippets.

@0x1b-xyz
Last active September 16, 2021 22:42
Show Gist options
  • Save 0x1b-xyz/daeed35f1c65ecd59d342710f57560fb to your computer and use it in GitHub Desktop.
Save 0x1b-xyz/daeed35f1c65ecd59d342710f57560fb to your computer and use it in GitHub Desktop.
Bash header opts and reminder to declare for subshell assignments
#!/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