Created
October 22, 2014 20:21
-
-
Save cebe/a220c8a9b6783503c407 to your computer and use it in GitHub Desktop.
variable name in shell misinterpreted.
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/sh | |
FOO="test" | |
BAR="123" | |
VAR="$FOO_$BAR" | |
# result is "123" instead of "test_123" because _ is seen as part of the var. | |
# how can I fix this? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
turns out the solution is
VAR="${FOO}_${BAR}"