#!/bin/bash # # To get this to work, there needs to be an appropriate # .rhosts file in the home directory (for root, this is /root). # # Lots of help from info bash and from the web pages # http://www.gnu.org/software/bash/manual/bash.html # http://www.tldp.org/LDP/abs/html/ # Assignments must have no spaces around the equals sign! # # Example for updating the time: # # do-lab date -s \"`date`\" # do-lab /sbin/hwclock --systohc # if [ "$1" = "-h" -o "$1" = "--help" ]; then echo "Usage: $0 [-o] command" echo " -o only executes on other machines in list" echo "Quotes on \"command\" is sometimes useful." echo "No \"command\" executes a login on each machine;" echo "for example, a compound command would look something like:" echo " $0 \"command1; command2\"" exit 1 fi # if [ "$1" = "-o" ]; then othersonly=1 shift fi # list="barak deborah jair gideon ehud shamgar jephthah jael" # for i in $list; do if [ "$othersonly" -a "$i" = `hostname` ]; then echo "host $i excluded:" else echo "host `rsh $i hostname`:" rsh $i $@ fi done