change environment variable in child process - bash -


hi have following example. a.sh script sets environment variable can see in b.sh (child) script, if change still have old value in a.sh

a.sh

#!/bin/bash  export a=1 ./b.sh echo parent $a 

b.sh

#!/bin/bash  echo child $a a=2 export echo child $a 

test:

bash-3.00$ ./a.sh child 1  child 2  parent 1  child 1  child 2 

in a.sh source b.sh instead of ./b.sh

a.sh should :

#!/bin/bash export a=1 source b.sh echo parent "$a" 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -