Path: utzoo!utgpu!watmath!clyde!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.questions Subject: Re: How to make a script file? Message-ID: <407@lakart.UUCP> Date: 30 Jan 89 16:49:14 GMT References: <5828@phoenix.Princeton.EDU> Distribution: na Organization: Lakart Corporation, Newton, MA Lines: 27 amlovell@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@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+