Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 1997 16:42:17 -0500 (EST)
From:      Greg Pavelcak <gpavelcak@philos.umass.edu>
To:        Robert Eckardt <roberte@MEP.Ruhr-Uni-Bochum.de>
Cc:        questions@FreeBSD.ORG, (Yingjun He) <hey@tuns.ca>
Subject:   Batch files and #!/bin/shell
Message-ID:  <XFMail.971119165054.gpavelcak@philos.umass.edu>
In-Reply-To: <199711192102.WAA01239@ghost.mep.ruhr-uni-bochum.de>

next in thread | previous in thread | raw e-mail | index | archive | help

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



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