0

I have a list of servers where I need to perform series of similar commands on each. Script takes information about commands from external file. Server`s list hardcoded into script itself. For this purposes I created a script. Unfortunate, it goes through server's list and takes only first line from input.txt

declare ip_array=( xxx.xxx.xx.xx yyy.yyy.yy.yy zzz.zzz.zz.zz )  

for ADDM_address in "${ip_array[@]}"; do

while IFS= read -r snmp_cred; do


    snmp_ip=$(grep -E -o "blabla" <<< $snmp_cred)
    snmp_ip=${snmp_ip%?}


   $perform some commands



done </tmp/input.txt


done

Content of input.txt file:

h3c/sseries/1.3.6.1.4.1.25506.11.1.99_hp_a3100_48_v2/172.30.152.20@public
h3c/sseries/1.3.6.1.4.1.25506.11.1.9_hp_v1905_24_poe/10.159.2.31@public
a10networks/generic/1.3.6.1.4.1.22610.1.3.16_ax3200_12/10.251.1.101@public

Can you help me to construct proper loop, so it goes through all content of input.txt file, non only through first element.

The output in terminal is:

http://prnt.sc/ceg27j

Vasyl Stepulo
  • 1,493
  • 1
  • 23
  • 43

0 Answers0