From owner-freebsd-questions Wed Nov 19 13:53:12 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id NAA02916 for questions-outgoing; Wed, 19 Nov 1997 13:53:12 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from tower.my.domain (nscs57p19.remote.umass.edu [128.119.181.54]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id NAA02876 for ; Wed, 19 Nov 1997 13:53:00 -0800 (PST) (envelope-from gp@tower.my.domain) Received: (from root@localhost) by tower.my.domain (8.8.7/8.8.7) id QAA03497; Wed, 19 Nov 1997 16:50:54 -0500 (EST) (envelope-from gp) Message-ID: X-Mailer: XFMail 1.1 [p0] on FreeBSD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit MIME-Version: 1.0 In-Reply-To: <199711192102.WAA01239@ghost.mep.ruhr-uni-bochum.de> Date: Wed, 19 Nov 1997 16:42:17 -0500 (EST) From: Greg Pavelcak To: Robert Eckardt Subject: Batch files and #!/bin/shell Cc: questions@FreeBSD.ORG, (Yingjun He) Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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