From owner-freebsd-questions Wed Nov 19 16:21:09 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id QAA16513 for questions-outgoing; Wed, 19 Nov 1997 16:21:09 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from send1b.yahoomail.com (send1b.yahoomail.com [205.180.60.23]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id QAA16498 for ; Wed, 19 Nov 1997 16:20:57 -0800 (PST) (envelope-from rgireyev@yahoo.com) Message-ID: <19971120002045.27832.rocketmail@send1b.yahoomail.com> Received: from [156.153.255.234] by send1b; Wed, 19 Nov 1997 16:20:45 PST Date: Wed, 19 Nov 1997 16:20:45 -0800 (PST) From: Rudy Gireyev Subject: Re: Batch files and #!/bin/shell To: Greg Pavelcak , Robert Eckardt Cc: questions@FreeBSD.ORG, hey@tuns.ca MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk #! string tells UNIX which shell will be interpreting the script that follows. If you are only writing scripts for yourself *aaaaand* you are certain you will never change your current shell :-) then you are OK. But if you change your shell in the future or give your script to someone who uses a shell other than yours then your script _m_a_y_ not work. So I guess it's a compatibility insurance. Rudy. ---Greg Pavelcak wrote: > > > On 19-Nov-97 Robert Eckardt wrote: > >It was Yingjun He who wrote: > >> Hello, > >> > >> Anyone knows how to run batch jobs in FreeBSD system? Thank you! > > > >Choose a shell of your taste (sh, bash, ksh, csh, tcsh, ... -- > >usually sh), > >read the corresponding man page and enter in a text file as the > >very first line `#!/bin/YourShell' (assuming YourShell is in /bin) > >followed by your batch commands. > >Your batch commands can be any commands you enter on the commandline > >plus some statements for flow control. > > > >Make the text file executable (chmod +x YourFile) and call > >YourFile like any other command. > > > >Hope, it helps, > >Robert > > I was just wondering what the !#/bin/yourshell does. I have written > executable scripts without the shell specification and they have > worked. For example to get my mail and news: > > > > /usr/local/bin/fetchmail; > /usr/local/bin/suck news.oit.umass.edu -dd /usr/gp -c -br > /var/mail/gpbr; > cat /var/mail/gpbr >> /var/mail/gp; > /usr/gp/bin/news2mail /var/mail/gp; > rm /var/mail/gpbr > > Am I playing with fire by not having the right first line. I execute > the above script several times a day and run it from cron at night. > > Greg > __________________________________________________________________ Sent by Yahoo! Mail. Get your free e-mail at http://mail.yahoo.com