From 21ad38ab24483595452daa03766e98eb2f86fbb3 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Fri, 9 Nov 2018 00:58:15 -0600 Subject: [PATCH] fixed duplication bug; swapped 'for' for 'while' --- tab-sorcery.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tab-sorcery.sh b/tab-sorcery.sh index 1b0b508..0dcc42b 100644 --- a/tab-sorcery.sh +++ b/tab-sorcery.sh @@ -14,7 +14,7 @@ get_hostip () { } zone_xfer=`dig $scan_domain @$scan_ns AXFR | egrep -v 'SOA|NS|MX|DiG' | grep $scan_domain | awk '{print $1,$4,$5}'` -for host in `echo $zone_xfer | awk '{print $1}'`; do +while read host <&3; do user_name=$3 connect_cmd="ssh -t" host_short=`echo ${host} | awk -F. '{print $1}'` @@ -36,7 +36,7 @@ for host in `echo $zone_xfer | awk '{print $1}'`; do get_hostip ${host} alias ${host_short}="${connect_cmd} ${user_name}@${host_ip}" fi >/dev/null -done +done 3< <(echo $zone_xfer | awk '{print $1}' | uniq) unset -f get_hostip return 0