How to “send” variable to sub-shell?
I have a
bash script and inside that script I do
sh. How to pass a variable to the new shell? This is how it is (simplified to the specific problem):
#!/bin/bash #...... MYVAR=myvalue sh -c 'some_code_here' #......
Basically I want to use the
MYVAR in my
some_code_here part. I am thinking of creating a temp script and executing it. But if there's a simple way to pass, I can avoid temp script.