amlovell@phoenix.Princeton.EDU (Anthony M Lovell) (01/27/89)
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 Can you tell me how to do this? Even if I must have 56 lines to meet the above criteria? Thanks mucho. -- amlovell@phoenix.princeton.edu ...since 1963.
les@chinet.chi.il.us (Leslie Mikesell) (01/27/89)
In article <5828@phoenix.Princeton.EDU> amlovell@phoenix.Princeton.EDU (Anthony M Lovell) writes: >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 > >Can you tell me how to do this? >Even if I must have 56 lines to meet the above criteria? >Thanks mucho. #! /bin/sh #first arg is N i=0 while [ $i -lt 56 ] do i=`expr $i + 1` case $i in ?) i=0$i ;; esac cat glob.$1 bb${i}.$1 | Mail bb$i done exit Les Mikesell
chris@mimsy.UUCP (Chris Torek) (01/27/89)
In article <5828@phoenix.Princeton.EDU> amlovell@phoenix.Princeton.EDU (Anthony M Lovell) writes: >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 Easy: for j in 0 1 2 3 4 5; do for i in 0 1 2 3 4 5 6 7 8 9; do if expr $j$i \> 56; then break; fi cat glob.$j$i bbi.$j$i | Mail bbi$j$i # I think you meant this done Incidentally, spawning 56 sendmails without waiting would be frowned upon on our machines. . . . (Hint: /usr/lib/sendmail -oi) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
dg@lakart.UUCP (David Goodenough) (01/31/89)
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 +---+