OT: Shell Script

Tim Sailer sailer at bnl.gov
Tue Feb 7 18:21:56 GMT 2006


On Tue, Feb 07, 2006 at 01:08:21PM -0500, Rodney Green wrote:
> 
> Hello,
> 
> In a shell script, does the command specified on one line wait until the 
> previous line's command finishes before running? I've looked at a few 
> tutorials but didn't find anything. I'm attempting to run a mail 
> archiving script that has to be run for each mail archive file. I don't 
> want them to all run at the same time as that would probably overload 
> the system.

That depends on the command. Some commands daemonize (run in the background)
when you run them. Most do not, by default. You can use something like:

#!/bin/sh
cd /var/spool/mail
for file in `echo *`
do
archive.cmd $file
done


Tim

-- 
Tim Sailer <sailer at bnl.gov> 
Information and Special Technologies Program
Northeast Regional Counterintelligence Office
Brookhaven National Laboratory  (631) 344-3001


More information about the MailScanner mailing list