Skip to content

Instantly share code, notes, and snippets.

@adoyle-h adoyle-h/1.bash
Created Jul 11, 2019

Embed
What would you like to do?
bash nameref FML
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
shopt -s inherit_errexit
[[ -n "${VERBOSE:-}" ]] && set -o verbose
[[ -n "${DEBUG:-}" ]] && IS_DEBUG=true || IS_DEBUG=false
foo() {
local -n a=$1
local b=2
echo "$a"
}
b=3
foo b
# It prints 2 not 3. WTF!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.