Dear All,
I am trying to call variables from one shell script to other. I used "source" and "export" but none are doing the job. A mention, that it is CGI bash script. And in the bash script there is also "<href>" HTML links to other CGI scripts. For example - I am doing like this;
script1: test1.sh
#!/bin/sh
echo "Content-type: text/html"
echo ""
....
export XX="1"
export YY="2"
"echo "<p><a href = "/path/to/second/CGI/script/test4.sh" >to choose click</a></p>"
script 2: test4.sh
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<body>"
echo "<form action="/path/to/third/CGI/script/test5-1.sh" method="GET">"
echo "</form>"
echo "</body>"
echo "</html>"
echo "XX =$XX"
script 3: test5-1.sh
#!/bin/sh
#source <(grep '^export .*=' test1.sh)
echo "Content-type: text/html"
echo ""
echo "XX = $XX"
but it gives me nothing in "test5-1.sh"
So, I called "test4.sh" from "test1.sh" and exported all variables of "test1.sh" as shown above. All the variables are exported well to "test4.sh" but the variables are not getting exported to "test5-1.sh" from "test1.sh". I want to use the variables of "test1.sh" in "test5-1.sh" also. Likewise, I have other bash scripts in the same directory, in which I would like to export the variables and their values from "test1.sh". Can you please let me know how can I do it? I tried "source" like above in "test5-1.sh" but it does not work. Please let me know if you need more information on this.
Thank you so much! DK