[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Newbie Shell Script Problems



To quote "Tom Schuetz" <tomschuetz@hotmail.com>,
# Could someone please give me a hint re. how to get a functional shell 
# script?
# 
# I've done the #! /bin/bash, and I've chmod'd to +x, and the CHMOD
shows up 
# correctly as executable in ls -l, but still will not "go".

If you run 'echo $PATH' from the command-line, you'll see where your
shell looks for commands when you try to run something. If your script
is not in one of those directories, you have to use the full pathname
when calling it. For instance, if your script is
/home/user/scripts/myfirstscript, and /home/user/scripts is not in
$PATH, you have to execute it by typing
'/home/user/scripts/myfirstscript'. If you're currently in
/home/user/scripts, you can just type './myfirstscript', since "./" is a
short form of for your current directory.

You should also have "#!/bin/bash" as the first line in your script. "#!
/bin/bash", with the space, is generally not how it's done. It probably
won't case any problems, but it's best to do things the way they're
expected to be done.

David Barclay Harris, Clan Barclay
    Aut agere, aut mori. (Either action, or death.)



Reply to: