How to make a script file?

Leslie Mikesell les at chinet.chi.il.us
Fri Jan 27 14:01:26 AEST 1989


In article <5828 at phoenix.Princeton.EDU> amlovell at 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



More information about the Comp.unix.questions mailing list