Created
October 17, 2010 08:54
-
-
Save thewoolleyman/630674 to your computer and use it in GitHub Desktop.
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
$ ./subshell_var_passing1 # why is var empty in the subshell? | |
local output: var=/tmp/aaa var2=/tmp/aaa | |
subshell output: var= var2=/tmp/aaa |
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
#!/usr/bin/env bash | |
echo 'aaa' > /tmp/aaa | |
var=( /tmp/aaa ) | |
export var | |
var2=$var | |
export var2 | |
echo "local output: var=$var var2=$var2" | |
echo $(./subshell_var_passing2) |
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
#!/usr/bin/env bash | |
echo "subshell output: var=$var var2=$var2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment