[techtalk] script help -- thanks!
alissa bader
mol666 at yahoo.com
Thu Sep 28 08:43:51 EST 2000
I would like to thank everyone who helped me with that
DNS script the other day. This is how I wound up
writing it:
#!/bin/sh
# to fix secondary dns entries
for DOMAIN in `cat /tmp/ns1stuff`
do
for DIR in `echo $DOMAIN |cut -c1`
do
echo "zone" '"'"$DOMAIN"'"' "{" >>
/etc/named.conf
echo " type slave;" >>
/etc/named.conf
echo ' file "'$DIR'/db.'$DOMAIN'";'
>> /etc/named.conf
echo " masters {" >> /etc/named.conf
echo " 204.177.32.2;" >>
/etc/named.conf
echo " };" >> /etc/named.conf
echo "};" >> /etc/named.conf
echo "" >> /etc/named.conf
done
(excuse please the ratty formatting here, damned
web-based email crap)
I opted not to drop the toplevel domain off of every
domain name, as we might run into duplicates here.
cut, as it turns out, really is my friend. :>
One thing I have noticed: you have to be really
careful and specific when you define each variable and
for loop. I have written a number of little scripts
that only ask for one variable. And I was agonizing
for hours over how to define a second one. Finally it
hit me to just add a for loop for it. And wouldn't
you know it, it worked!
sed sounds like it's pretty much worth knowing,
although I didn't have to use it in this script. time
to poke over the man pages!
again, thank you all so much, never could have gotten
it working without you. :>
--alissa
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
http://photos.yahoo.com/
More information about the Techtalk
mailing list