Hello all,
I'm trying to ssh to a list of hosts one by one and run a grep command on each host. But my while loop is only reading the first line and quitting.
Code:
#!/bin/bash
while read hostName
do
ssh vision@$STORE "grep LANE_INFO vision.cnf"
done </tmp/test-hosts.txt
I read online that this might be do to ssh reading from the same file as the while loop, but I'm not sure how to get around that. Also I don't know for sure that is the issue here.
Any help is appreciated.
Thanks.