Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 1997 16:20:45 -0800 (PST)
From:      Rudy Gireyev <rgireyev@yahoo.com>
To:        Greg Pavelcak <gpavelcak@philos.umass.edu>, Robert Eckardt <roberte@MEP.Ruhr-Uni-Bochum.de>
Cc:        questions@FreeBSD.ORG, hey@tuns.ca
Subject:   Re: Batch files and #!/bin/shell
Message-ID:  <19971120002045.27832.rocketmail@send1b.yahoomail.com>

next in thread | raw e-mail | index | archive | help
#! 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 <gpavelcak@philos.umass.edu> 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




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