Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2002 23:43:14 -0500
From:      Scott <scottro@nyc.rr.com>
To:        "Jeff Jeter" <gsfgf@hotmail.com>, "FreeBSD Questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Shell Scripts
Message-ID:  <5.1.0.14.0.20020314233515.00c24b58@pop-server.nyc.rr.com>
In-Reply-To: <OE14RzpPWywCP6K8CAC00017aa7@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 23:19 2002/03/14 -0500, Jeff Jeter wrote:
>How do i make a shell script run if i just type in the file name if i am in
>the dir or if it's in my path?


If it's in your path, then simply typing the script name will make it 
run.  Say you have a script called scriptx.  If it's in any of the 
directories in your path (which you can find out by typing echo $PATH it 
will run anytime you type, at a command prompt
scriptx

If however, it's not in your path--for example, you have a directory called 
test, that's not in your path.  You put scriptx in directory test.  Now, if 
you're in directory test and you want to run scriptx you simply type ./scriptx

(Before doing this, you have to make the script executable by doing a 
chmod--for example, if you want all users to be able to use the script
chmod 755 scriptx)

The other way to do it (and you don't even have to do a chmod for this to 
work) is to type sh scriptx.  Or, if you're in your home directory, and 
scriptx is in the test directory which is in your home directory
sh test/scriptx

HTH. Not sure how much you know about all this, so if I gave you too much 
information, I apologize.

Scott Robbins


>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.0.14.0.20020314233515.00c24b58>