How can I set a time limit of 10s for each moment I execute the command "iperf" in the until loop below? (I don't want the iperf to stay with a host more than 10s)
Code:
while read loop; do
TRIES=1;
until ./iperf -c $loop -w 0.5M -n 2M > $loop && grep -q "size" $loop.iperf; do
if [ "$TRIES" -ge 1 ]; then
echo "+ Inner loop: $loop";
break;
fi;
echo "+ Inner loop: $loop";
TRIES=`expr $TRIES + 1`;
done;
done < list