I run the following script:
VAR="Test" sh -c 'echo "Hello $VAR"'
But I get :
# ./test.sh Hello
How can I "send" the variable
VAR of my script to the shell created with
Or simply use double quotes to allow interpolation without having to export anything nor pass the var to the command:
Here's yet another way to pass variables to
If you don't want to export them as environment variables, here's a trick you could do.
Save your variabe definition to a file
from the command line:
This way, you only set your variables at the execution of your subshell.