Hi, I am trying to write a script with scans a list of nodes.
I did this, but when the nodes are not active, I get segmentation fault ! what could be the reason ?
Code:
#!/bin/bash
success="1 packets transmitted, 1 received, 0% packet loss, time 0ms"
for i in `seq $1 $2`
do
# first it should be checked if the node exists !
# second, we test if we get answer with the ping
read test_string <<< $(ping -c1 -w1 node${i} | grep '1 received')
echo $test_string
if [[ ${test_string} = ${success} ]]
then
#echo $test_string
echo " node${i} seems to be active "
fi
done