[techtalk] need help with a shell script
Olivier Tharan
olive at minet.net
Tue Sep 26 22:58:02 EST 2000
Le 26 septembre 2000 a 11:41, alissa bader a écrit :
> zone "domain.com" {
> type slave;
> file "d/db.domain";
[ ... ]
> The way I have it written so far is:
> #!/bin/sh
> for DOMAIN in `cat /tmp/ns1stuff`
> do
> echo "zone" '"'"$DOMAIN"'"' "{" >> /etc/named.conf
> echo " type slave;" >> /etc/named.conf
> echo ' file "'$DOMAIN'";' >> /etc/named.conf
> (etc etc etc)
Perhaps this could help:
#! /bin/sh
for DOMAIN in `cat /tmp/ns1stuff`; do
# cut(1) is your friend, here
FIRST_LETTER=`echo $DOMAIN | cut -c1`
CUT_DOMAIN=`basename $DOMAIN .com`
CUT_DOMAIN=`basename $DOMAIN .net`
CUT_DOMAIN=`basename $DOMAIN .org`
# don't sweep named.conf too early :-)
cat >> /etc/named.conf.00 <<EoF
zone $DOMAIN {
type slave;
file ${FIRST_LETTER}/db.${CUT_DOMAIN};
};
EoF
olive
--
Olivier Tharan, <olive at minet.net>
Accroche-toi au clavier, j'enleve les shells...
----- End forwarded message -----
--
Olivier Tharan, <olive at minet.net>
Les vrais programmeurs ne mangent pas de quiche.
More information about the Techtalk
mailing list