Last active
August 29, 2015 14:26
-
-
Save carld/60b2785f6f26f8151642 to your computer and use it in GitHub Desktop.
prompt for a command to run on multiple hosts via ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HOSTS=( host1 host2 ) | |
USER=me | |
while read -e -p "-> " CMD </dev/tty | |
do | |
for host in "${HOSTS[@]}"; do | |
echo $host | |
ssh $USER@$host -C $CMD | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment