Here is an excerpt from my Bash script
#!/bin/sh
# Check SPEED parameter validity
if [ "$4" = "SPEED" ]
then
source ${SIM_DIR}/setEnv.sh speed
elif [ "$4" = "NORMAL" ]
then
pushd ${SIM_DIR}/scripts
source setEnv
else
ERROR "Invalid SPEED|NORMAL parameter ($4)."
exit 1
fi
In command line, I am giving the option as NORMAL when I run the script. There is no file called setEnv.sh in the ${SIM_DIR}/scripts location. There is however a file called setEnv and its first line is #!/bin/bash -x. I get the following error:
line 176: source: setEnv: file not found
Could anybody kindly point out what is wrong with my script?
"${SIM_DIR}"pwdcommand and anlscommand to your script, to see clearly in which directory it is running and which files really are there.#!/bin/bash -xhas no effect if you source a file.#!/bin/bashinstead of#!/bin/sh, since the sh on my system doesn't havepushd), it works as expected on my system. Your problem seems to be elsewhere.