[LBo] Running shell script
Chris F.A. Johnson
cfajohnson at teksavvy.com
Fri Jan 5 20:54:35 CET 2007
On Fri, 5 Jan 2007, Rafi Gabzu wrote:
> I probably missed something , why in order to run shell script I
> need to use the dot and back slash :(e.g ./hello.sh ) ? why not just to
> run it ...?
You can either use ./scriptname (that's a slash, not a backslash),
or you can put the script in a directory that is included in your
PATH. I recommend that you do the latter.
The shell looks in the directories in your PATH variable (a
colon-separated list of directories), and the current directory is
not usually included (nor should it be).
I recommend that you create your own directory (e.g., $HOME/bin)
and add it to your PATH in $HOME/.bashrc:
PATH=$PATH:$HOME/bin
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
More information about the QnA
mailing list