Im running a script that runs scripts within it self and i need to pass vars made in the original script to scripts run within it and the only way i can think to do it is right the string to a file and read the file in the script
In the original script, when calling another script:
var1="`hostname`"
/mydir/my-other-script $var1
Maybe i can function
$. principal_script var1 var2 var3 ......
........................
. subscript1 $var1 $var3
.......................
. subscript2 "$@" #if you like to pass all var
Bye
I the main script, export those variables you want others to see:
#this is main script
export VAR1="value_var1"
./script.sh
VAR1 will be available to ./script1.sh
(for bash)
Regards.