# IPLIST="ip_list"
[root@V440]# for ip in $IPLIST
> do
> ret=$( ssh $1 /opt/tools/utils/HUB/GEW-VLANStats-P3 )
> echo $ret
> done
bash: ssh: command not found
Please make sure the variable IPLIST is populated correctly with the required IP address only separated by space as shown in the previous post.
Also, why did you use $1 in your code?
#ssh -l 1.1.1.1
enter password #telnet 169.1.1.1
enter user & password #aux_stats -v
and print output (need it run twice i.e aux_stats -v to produce a comparison)
---------- Post updated at 01:40 PM ---------- Previous update was at 01:38 PM ----------
required ip address of a particular site? I need it to compare from the list ip_list?
$1 i copied this from $1 /opt/pds-tools/utils/HUB/GEW-VLANStats-P3 output
---------- Post updated at 01:47 PM ---------- Previous update was at 01:40 PM ----------
I think you misunderstood let me explain, the script runs ok against 1 ip address
i.e say i have a list of 30 ip's i want it do to the first ip check then I want it to repeat the first one then move onto the second ip on the list, repeat the check of the second one and then move onto the third....and so on..
---------- Post updated at 02:11 PM ---------- Previous update was at 02:09 PM ----------
That is a simple while loop. It reads each line from the file ip_list into the variable ip. And within the loop, it is being echo-ed here. You missed the do and echo.
And regarding you second requirement, I still didn't get you. You want to check if the first IP was ok and then continue with the next IP's? or is it something else?
while read ip (while read is a linux script ? ip is there any significance to internet protocol?
do (ok do the following scripts twice)
check_GE-VLANStats-P3 $ip (then echo to my variable $ip)
check_GE-VLANStats-P3 $ip
done < ip_list
While <condition true>;do;done : In this case while there is an IP to read from input; do;etc...
the done is executed after the last line given in input (< sign)
This is the standard way to NOT use cat (useless use of cat...) which would have been like:
cat ip_list | while read IP
do
..
done
I put the bit of code here so you see the "done" and so you can compare with its counterpart you know