HI,
I haven't done Bash scripting in a while. Got a simple problem. I want to test the logging on via ssh to 100+ servers from a single jumpbox.
!/bin/bash
for host in $(cat servers.txt)
do ssh -q -o NumberOfPasswordPrompts=1 "$host" "hostname"
done > test.log
This is my attempt its pretty simple and works as long as you're pressing the return key all the time!
Is there anything better out there?
Top comments (1)
Hi there! Welcome to the community! I found this answer to a similar question on StackOverflow. I tested it out and it seems to work well as long as you use an ssh key that doesn't have a passphrase on it.
On a DEV tips note:
This yields:
help
tag on your articles to have it featured in section of the site specifically for asking questions and getting help.#help
Let me know if this helps!