[1635] in linux-net channel archive
script to execute program for every machine listed in /etc/hosts???
daemon@ATHENA.MIT.EDU (Geis Jerry)
Mon Jan 15 21:35:19 1996
From: Geis Jerry <GeisJ@rnd3.indy.tce.com>
To: "linux-net (rutgers)" <linux-net@vger.rutgers.edu>
Date: Mon, 15 Jan 96 15:52:00 PST
Hi,
I am not a shell script expert and hope that someone can suggest a
better
way of executing a program using rsh on every machine listed in /etc/hosts.
This is what I came up with. Looks kinda ugly. Is there a better way???
Thanks for any suggestions.
Jerry Geis
--------------
cat /etc/hosts | awk -v host=$hostname '{
do
{
notdone = getline
if ((notdone > 0) && (length($0) > 5) && ($2 != "localhost") && ($3
!= "") && ($3 != host) && ($1 != "#"))
{
x=sprintf("rsh %s /path/to/program &", $3)
print "Executing... ", x
system(x)
}
}
while (notdone > 0)
}'