[ale] first time shell script
Byron A Jeff
byron at cc.gatech.edu
Tue May 6 16:17:49 EDT 2003
>
> I have been doing some reading about shell scripts and have some
> questions. I am using the BASH shell on Mac's OSX.
>
> Most sample scripts say to change the file to an executable via "chmod
> u+x scriptname"
> After doing this i should be able to simply type in "scriptname" and it
> should run.
It's a necessary but not sufficient condition.
>
> I cant seem to get this to work, I must enter it like this
> "bash scriptname"
>
> is this normal or am I not doing something correct?
It's normal.
The second part of the equation is your path. Most likely the current directory
isn't in it. You can see by issuing the command:
$ echo $PATH # Note that the first $ is the prompt and the # starts a comment
Here's the output from mine:
byron at upstairs:byron$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:.:/opt/kde/bin
Note that the current directory [.] is in the list. I'll be a dime to a dollar
that you don't have the current directory in your path.
You can add it by doing the following:
$ PATH=$PATH:.
You can also add this line in your .bashrc file in your home directory.
I would suggest putting it last to that someone can't substitute their own
command for a common one.
Hope this helps,
BAJ
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list