From owner-freebsd-questions Mon Oct 20 18:00:15 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id SAA05128 for questions-outgoing; Mon, 20 Oct 1997 18:00:15 -0700 (PDT) (envelope-from owner-freebsd-questions) Received: from DonaldBurr.dyn.ml.org (root@ppp12180.la.inreach.net [206.18.115.180]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id RAA05068 for ; Mon, 20 Oct 1997 17:59:55 -0700 (PDT) (envelope-from dburr@POBoxes.com) Received: from DonaldBurr.dyn.ml.org (dburr@DonaldBurr.DonaldBurr.dyn.ml.org [192.160.60.1]) by DonaldBurr.dyn.ml.org (8.8.5/8.8.5) with SMTP id SAA07626; Mon, 20 Oct 1997 18:01:17 -0700 (PDT) Message-ID: X-Mailer: XFMail 1.1 [p0] on FreeBSD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199710202356.QAA29920@hub.freebsd.org> Date: Mon, 20 Oct 1997 17:59:17 -0700 (PDT) Organization: Starfleet Command From: Donald Burr To: questions@FreeBSD.ORG Subject: RE: questions-digest V3 #489 Cc: jcwells@u.washington.edu Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk -----BEGIN PGP SIGNED MESSAGE----- My secret spy satellite informs me that on 20-Oct-97, owner-questions-digest@FreeBSD.ORG wrote: >From: Jason Wells >Date: Mon, 20 Oct 1997 20:44:50 +0000 >Subject: Force a script to use shell foo > >Lets say I run a script from cron. There is no shell to inherit. The >script >would use /bin/sh. But silly me, I wrote my program to use bash. > >Is it sufficient to just enter the command /usr/local/bin/bash within the >script to get the script to use bash? If not, how do I set up an >environment for a program? The proper way of doing this is to include the following line as the VERY FIRST LINE In your script: #!/path/to/shell For example, to run a shell script using tcsh, which is located in /usr/local/bin, you would place: #!/usr/local/bin/tcsh as the first line. Note that you can also use this with other types of interpreted languages, e.g. PERL. if you have a PERL script you want to be able to execute by just giving its name (to be able to type "foo" instead of "perl foo" at the cmdline), add #!/usr/local/bin/perl (or /usr/bin/perl, etc.) as its first line. Be sure the file is executable! (chmod +x filename) - --- Donald Burr - Ask me for my PGP key | PGP: Your WWW HomePage: http://DonaldBurr.base.org/ ICQ #1347455 | right to Address: P.O. Box 91212, Santa Barbara, CA 93190-1212 | 'Net privacy. Phone: (805) 957-9666 FAX: (800) 492-5954 | USE IT. -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBNEv+3PjpixuAwagxAQGz9AP9FAzW85iX3EiuKJa27MEfgpDv6UAW7qI7 +fPd7RqEY+imcjaBLTZ1sTEDkUSJ8UJw2onVGgCz0yGQb7OhMRa1QdDmyXdbrRCQ timroJd1GHDs532sZMhEXyVIBEy3nN+qrA86DBxPEItzASXQme9H20272v1H9Czj vEiK5PtBehU= =au9H -----END PGP SIGNATURE-----