You may want use the for function.
Use man bash to understand how it works.

---
Cordiali saluti / Best regards
Andrea Cerrito
^^^^^^^^^^^^^^
Net.Admin @ Centro MultiMediale di Terni S.p.A.
P.zzale Bosco 3A
05100 Terni IT
Tel. +39 744 5441330
Fax. +39 744 5441372

-----Messaggio originale-----
Da: jcarreiro [mailto:[EMAIL PROTECTED]]
Inviato: mercoled� 23 maggio 2001 10.25
A: [EMAIL PROTECTED]
Oggetto: help: bash script to use with vadddomain (vpopmail)

hi all,
 
i'm trying to write an script who automatically creates new virtual domains in vpopmail
 
my script uses the vadddomain binarie from vpopmail.
 
the syntax for vadddomain is : vadddomain [domain name] [postmaster passwd]
so i create i text file with :
 
...
...
test.com test
...
....
 
the problem is that vadddomain doesn't treat my file per line ....
well, i'm a script newbie, so i let you see what i'm doing :)) script is next :
 
----------------------------------------------------------------------------------------------------------------------------------
PATH="$PATH:/var/spool/popmail/bin"
 
VDOMAINSFILE="/home/tech/vdomain.txt"
VDOMAINSOLDFILE="/home/tech/vdomain.txt.old"
NEWDOMAINSFILE="/home/tech/new_vdomains.list"  
NEWVDOMAINS="/var/tmp/new_vdomains.tmp"
 
if test -s $VDOMAINSFILE
then
if [ $VDOMAINSFILE -nt $VDOMAINSOLDFILE ]; then
diff -u $VDOMAINSOLDFILE $VDOMAINSFILE | grep -v "^+++" | grep -v "^+;" | grep "^+" | sed -e s/^+//g >> $NEWVDOMAINS
fi
#
awk 'BEGIN { FS=":"} {print $1 " " "test"}' $NEWVDOMAINS > $NEWDOMAINSFILE
 

   
vadddomain && cat $NEWDOMAINSFILE
  
rm $NEWVDOMAINS $NEWDOMAINSFILE
------------------------------------------------------------------------------------------------------------------------------------------------------
 
and here the output file :
-------------------------------------------------------------------------------------------------------------------------------------------------------
# less new_vdomains.list
test.org testorg
test.net testnet
 
---------------------------------------------------------------------------------------------------------------------------------------------------------
 
thx in advance
 
 

Reply via email to