Skip to content

Instantly share code, notes, and snippets.

@seancheung
Created November 8, 2017 09:49
Show Gist options
  • Save seancheung/cbe3f27fd47de061dbe740d88fd2589e to your computer and use it in GitHub Desktop.
Save seancheung/cbe3f27fd47de061dbe740d88fd2589e to your computer and use it in GitHub Desktop.
exec commands on multiple remotes
#!/bin/bash
USERNAME=$(whoami)
declare -a HOSTS=(
hostname1
hostname2
hostname3)
for i in "${HOSTS[@]}"
do
ssh "$USERNAME"@"$i" "$1"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment