Dear
I have a problem on which I turn araound since hours.
Hope you could help me.
I have a bash script, which activates with "nohup ./script2 params & " several subscripts.
In my main script, I have set lot's of variables, which I would pass into script 2.
My idea is now to create a file with parameter content, like:
envCode="X"
envPath="../temp/X"
...
Then I just pass over this parameter path & filename and execute it then in the subscripts.
So far this works well.
Here my questions:
1) Is there a possibility to create the parameter file more dynamically, e.g. by all parameters defined in main script when parameter file is created ? (like env but for script variables only..)
2) When I have a list of variable names I want to pass, how could I dynamically fill the parameter file.
E.g.
cat my_file_with_parameternames.txt
envCode
envPath
echo $envCode
X
echo $envPath
../temp/X
for k in `cat my_file_with_parameternames.txt`
do
echo $k=<value of $k variable>" >> my_parameter_file.sh
done
cat my_parameter_file.sh
envCode=X
envPath=../temp/X
Maybe it's not the first time this question is asked, but to be honest, I'm google since hours... Most probably I do not know the correct words to search for ;-(
Any help would be great.
many thanks in advance
Wolfgang