How to make a script file?

David Goodenough dg at lakart.UUCP
Tue Jan 31 02:49:14 AEST 1989


amlovell at phoenix.Princeton.EDU (Anthony M Lovell) sez:
> I tried this once before and it didn't seem to go as advertised.
> 
> I want to write a shell script (or whatever) which will be used thusly:
> 
> scriptname N   ( N an integer)
> for i := 1 to 56 do
>   cat glob.N bbi.N | Mail bbi
> 
> It's pretty easy, I guess - important things to note are that the files
> and address aliases bbi must have I always as 2 digits.
> ie: bb09

Try the following.

#! /bin/sh

a=0
while test $a -le 56
do
    b=`echo $a | awk '{ printf "%02d", $1}'`
    cat glob.$1 bb$b.$1 | Mail bb$b
    a=`expr $a + 1`
done

-- 
	dg at lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp at xait.xerox.com		  	  +---+



More information about the Comp.unix.questions mailing list