Skip to content

Instantly share code, notes, and snippets.

@jasenmichael
Last active January 5, 2022 00:00
Show Gist options
  • Save jasenmichael/0619e4eb1d29cd88b58c6937fcb27b0b to your computer and use it in GitHub Desktop.
Save jasenmichael/0619e4eb1d29cd88b58c6937fcb27b0b to your computer and use it in GitHub Desktop.
ssh-list.sh
#!/bin/bash
usage() {
cat <<EOM
Usage:
$(basename $0) '[remotes]' '[command]'
example:
$(basename $0) 'ELIT ASHC' 'cd /var/www/html && pwd'
EOM
exit 0
}
[ $# -ne 2 ] && { usage; }
clients=($1)
for i in "${clients[@]}"
do
ssh $i $2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment