====== Multi server update script ====== This script updates all Debian servers from the list by apt-get update and upgrade commands. It is highly recommended you have key authorization on all systems or you will have to insert all passwords... #!/bin/bash SERVERS=( server1.com server2.com etc.com ) keychain ~/.ssh/id_dsa -Q -q --lockwait 5 --attempts 5 --nolock; source ~/.keychain/*-sh; for SERVER in "${SERVERS[@]}"; do echo "Working on $SERVER"; # user-defined command? if [ -z "$1" ]; then ssh root@$SERVER 'apt-get -y update; apt-get -y upgrade'; else ssh root@$SERVER "$1"; fi done Could be... $ up-servers 'cat /etc/debian_version' Working on server1.domain.com 3.1 Working on server2.domain.com 3.1 Working on server3.domain.com 3.1 ...