I don't think my question has been asked before (not exactly anyway, if it has, apologies). I am using Tomcat 7 on CentOS 7.
In my tomcat/bin/setenv.sh file I have set:
export TEST="test"
Then I start tomcat via Terminal by running tomcat/bin/startup.sh
Then I run (not in a script, just in the Terminal after I have executed the Tomcat startup script):
echo $TEST
My question: Should I be able to "echo" the variable TEST? Should I be able to see that the TEST variable has been set to what I want it to be (test)?
Best Answer
No.
The
startup.sh
script may be sourcing thesetenv.sh
file to get the variable's value, but if it does, the variable will only be set within the environment of thestartup.sh
script, not in you interactive shell.If you want to see what's happening when you run
startup.sh
, first determine what shell interpreter it's using (see the#!
-line at the top of the file).If it's
bash
, run it with(i.e. add
-x
to the command line)This will turn on tracing of the script.