linux - Passing one shell script variable to another shell script -


i trying access 1 script variable script example,

script1.sh:

export a=10 export b=20 echo "testing" exit 

script2.sh:

. script1.sh echo $a 

the problem involved here able access variable 'a' script1 in script2 executing all commands written in script1.sh annoying. want access exported variables in script1 , donot want run commands in script1 while calling in script2.

kindly help!

thanks,
karthik

assigning variable command. unless you're prepared write bash parser in bash, want cannot done.


Comments