I have a list of servers in a addresses.txt file in the following format
xx.xxx.xx.xx
xx.xxx.xxx.xx
xxx.xx.xx.xx
The ip addresses change everyday and I get a new .txt file. The number of servers might change everyday. Im using a Mac so Im using csshx.
I'm trying to csshx into the servers so I need to create a command like this everyday.
csshx -login username --ssh_args "-i ~/.ssh/sshkey" xx.xxx.xx.xx xx.xxx.xxx.xx xxx.xx.xx.xx.
Is there a way to create a shell script so that I can just run the cssh -login username --ssh_args "-i ~/.ssh/sshkey" part and automate the rest of the line using variables from the addresses.txt file? I was thinking of using a for loop but the command needs to be in 1 line.