[prog] assigning variables in sh
aec
brat at magma.ca
Tue Jan 11 05:38:58 EST 2005
Hello
I have a sh script that polls several servers and stores the
result in $serverfile, the file looks like this:
141.414.184.125:5156
237.215.575.155:5157
136.315.470.145:6000
xion.serve.org:5154
remaag.lidet.net:5555
showme.bomang.ca:25154
noel.sleepy.us:5165
I obtain this list with curl:
servers=" `curl -q "http://list.somelist.foo/db/?action=LIST&nameport=&"
2>/dev/null | grep 0023 | cut -f1 -d ' '`"
[ $? != 0 ] && echo " NOT okay" && echo "ERROR: unable to curl
http:////list.somelist.foo" && exit 1
echo " okay"
echo -n "... writing server list to temporary file ..."
cat > "$serverfile" <<EOF
$servers
EOF
I want to now, perform an action on each server in the list, so
I need to iterate over the list somehow and this where I not sure
what the best approach is.
I would love to end up with a set of variables, $server1 $server2
and so on.. this would make further operations later on in the
script a cinch.
Can some one give me a shove in the right direction?
Thanks.
--
Angelina Carlton
More information about the Programming
mailing list