I use to be able to do a . test.sh shell script but now I have to do ./test.sh
Can someone explain what has most likely happen to cause this.
thank you
I use to be able to do a . test.sh shell script but now I have to do ./test.sh
Can someone explain what has most likely happen to cause this.
thank you
Most likely is that the directory you are running test.sh from is not in the PATH
You could be missing a . in the PATH variable. A . denotes the current directory.
Don't confuse . (source the script) with ./ (Under the current directory)
. test.sh = source test.sh
Now the shell looks for the directories in the path ($PATH). If it finds test.sh in any of those directories it will execute or you would have to go to that directory and do a ./test.sh
To avoid doing a ./ do the following.
Edit your .bash_profile or .bashrc file under your home directory.
add the line
export PATH='$PATH:.' -> i.e. add a . to the end of the path
If this doesn't work for you change the single quotes to double quotes.
Run echo $PATH to check if the path is correct.