I am using Centos 6.5
I noticed some of our software wasn't working right and it was due to path errors and other environment setting being incorrect. I've run some test and (I am not an expert on Linux) when I use the export command to set an environment variable at the prompt, it works fine, such as
export PATH=$PATH:/opt/application
This will add the default path to the new addition just as expected.
But when I put the above command in a shell script and run the script, the path is NOT changed.
I have tried:
PATH=$PATH:/opt/application
export PATH
I tried:
PATH=${PATH}:/opt/application
export PATH
and
export PATH=$PATH:/opt/application
as well as
export PATH=${PATH}:/opt/application
But as soon as you do an echo or env command all you get back is the default PATH setting.
I cannot figure out why the prompt works but the shell script does not. I am running as root.