Visit Our UNIX and Linux User Community

Help with why I need to use ./

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with why I need to use ./
# 1  
Old 07-22-2009
Help with why I need to use ./

I use to be able to do a . shell script but now I have to do ./

Can someone explain what has most likely happen to cause this.

thank you
# 2  
Old 07-22-2009
Most likely is that the directory you are running from is not in the PATH
# 3  
Old 07-23-2009
You could be missing a . in the PATH variable. A . denotes the current directory.
# 4  
Old 07-23-2009
Don't confuse . (source the script) with ./ (Under the current directory)

. = source

Now the shell looks for the directories in the path ($PATH). If it finds in any of those directories it will execute or you would have to go to that directory and do a ./
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.

Previous Thread | Next Thread
Test Your Knowledge in Computers #332
Difficulty: Easy
It is possible to format a write-protected DVD-R hard disk.
True or False?

Featured Tech Videos