I couldn't quite get your script to work. And not being a fan of the C-shell, didn't try too hard
What you could do is something like:
#!/usr/bin/csh
while( "$1" != "" )
# do what you have to do... ping, nslookup, etc. as before
shift
end
shift [variable ]
The components of argv, or variable, if supplied, are shifted to
the left, discarding the first component. It is an error for the
variable not to be set or to have a null value.
Or you could use a for-loop. In a decent shell (i.e. not csh!), such would be each:
for SERVER in $@; do
if ping $SERVER| grep alive; then
echo "Server alive..."
if nslookup $SERVER 2>&1 | grep Non-existent; then
echo "No server..."
fi
fi
done