while read host; do
echo "running on $host"
ssh -n $host "ls " >> output.txt;
done < boxes.txt
where boxes.txt is a file containing a list of machines to ssh to
advanced reading
Alternative:
for loop in {281..284}
do
echo "running on frread@nygeqgd0$loop.us.db.com"
ssh -n frread@nygeqgd0$loop.us.db.com "ls " >> output.txt;
done
2nd Alternative:
for loop in `seq 281 284`
more bash loops
No comments:
Post a Comment