Shell script - run command using variable from a list
Posted on 2016-09-26
I need to issue a command to 10 hosts remotely and I was wondering what would be the best way to script it so I wouldnt have run it over and over for each one of them...
I was thinking on having a host list variable in a script and use:
ssh $HOST <command>
For each command I run I need to create a output file in the local machine where Im issuing the command from...
So it would be: ssh $HOST1 <command> > HOST1, ssh $HOST2 <command> > HOST2.. and so on....
What would be the best way to do it in a shell script?