I have a bash script I'm running with sudo
that is supposed to call three other bash scripts. Two of the scripts that are called run fine. One of them, however, attempts to call a python script. The path to this python script is given in the script as SCRITPS_URI="${HFGEO_HOME}/bin/waveform.py."
My problem is that despite trying many different approaches, I can't make the third script properly expand $HFGEO_HOME.
I have tried:
exporting it
running with sudo -E bash -c
running sudo HFGEO_HOME=/data/hfgeo/ ./script.sh
https://askubuntu.com/questions/57915/environment-variables-when-run-with-sudo
adding it to my ~/.bashrc
and my ~/.bash_profile
Running sudo visudo
and adding it to my defaults env_keep
https://askubuntu.com/questions/57915/environment-variables-when-run-with-sudo (Second to last answer)
I keep getting the error python: can't open file '/bin/waveform.py': [Errno 2] No such file or directory
I have confirmed that the file is where it is supposed to be. In my bashrc
and bash_profile
files I am exporting the variable as:
export HFGEO_HOME=/data/hfgeo
and then add it to my PATH variable as
export PATH=${PATH}:${HFGEO_HOME}/bin
What's bugging me is that the system I'm trying to set up is running on the same OS, albeit a newer version, as another machine I have where this script works just fine. The original machine is running CentOS 6.4 and the machine I am having this problem on is running on CentOS 6.9. I did not have to do any of the above to get this script to work on the 6.4 machine. I've already tried fixing this myself and some of the above attempts I made were based on my research, but none of them seemed to fix my problem. What am I doing wrong?
script.sh
withenv
? i.e.sudo HFGEO_HOME=/data/hfgeo/ env
=> DoesHFGEO_HOME
appear in the output?sudo env VARIABLE=value cmd
.SCRITPS_URI
?SCRITPS_URI
I double checked