3 ms·
export YOU_FORGOT='this one' (Hint: it's most similar to your second one)
by Izkata 4y ago
export YOU_FORGOT='this one'
(Hint: it's most similar to your second one)
- cerved 4y agothis has nothing to do with quoting also='another way to pass variables to child scopes' sh -c "echo $also"
- Izkata 4y agoNeither of those are passing variables, those are setting environment variables. Bash (probably most shells?) mixes its variables with environment variables, and "export" is how you promote a bash variable to an environment variable. The inline version (GGP's [THE=tell the] version) sets the environment variable only for that one executable, while an exported one persists. Also I'm guessing you didn't test that, you got the quoting wrong (it prints nothing, the second one should be single quotes) ;)
- cerved 4y agoThey are both variables. I just wanted to show how it's different from export no I'm on my mobile so I sure did not, should be sh -c 'echo "$var"'