Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to compile .sh script...

Status
Not open for further replies.

korona100

MIS
Oct 22, 2001
11
US
I'm looking for an easy way to compile an .sh script. I'm not a developer so any useful info would be appreciated. What I'm basically trying to do is be able to run an .sh script without having to specify sh first, i.e. 'sh program.sh'. I want to be able to run the script from the command line just by typing 'program' Thanks in advance.

Mark
 
Try adding . to your path e.g. PATH=$PATH:. (for k shell)

I love deadlines. I like the whooshing sound they make as they fly by - Douglas Adams
 
Also, rename the program from 'program.sh' to 'program'. The '.sh' is really cosmetic.

And, if it's not there already, add '#!/bin/sh' as the first line of the script. You can type 'which sh' to verify that this path is right for your system.
 
chmod 700 scriptname and use the bang notation
on the first line(#!/bin/yourshell).
 
Thank you, adding the #!, changing the permissions, and modifying the PATH got it working for me. Thanks to all of you for your replies.
Thanks again,
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top