Skip to content

Instantly share code, notes, and snippets.

@awaxa
Forked from pporada-gl/indirect expansion
Last active May 22, 2022 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awaxa/c970c05feb47f40976cea987d409ebdf to your computer and use it in GitHub Desktop.
Save awaxa/c970c05feb47f40976cea987d409ebdf to your computer and use it in GitHub Desktop.
ENVIRONMENT="$1"
test_CNT="thing1 thing2 thing3"
beta_CNT="thing4 thing5 thing6"
varname=${ENVIRONMENT}_CNT
for i in ${!varname}; do
echo $i
done
####
# Expected output
$ bash script.sh test
thing1
thing2
thing3
$ bash script.sh beta
thing4
thing5
thing6
# Actual output
(as expected)
@pporada-gl
Copy link

Really really fucking cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment