2

I have a list of IP addresses I need to ssh into, making unique changes to each one. I tried doing

while read -r line; do ssh -n $line; done < file

but I need to manually run commands and checks on each device. The second I login it kicks me out to the next one. Are there any read line or ssh options that can allow me to do this?

1
  • That outputs the contents of the file into the terminal of the remote device. Commented Jan 21, 2014 at 19:40

1 Answer 1

6

Tell read to use a different FD, then you can remove the -n from ssh.

while read -u 3 ...
do
   ...
done 3< file
Sign up to request clarification or add additional context in comments.

1 Comment

Ooh, nice, didn't know about -u, points for you ;)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.