using our internal os utility (called mvsping) we need to check all these servers if they are reachable
Our field 1 is IP and field2 is servername. I need the output of the script's to show a message like
Server : $servername "with IP "$ipaddress"is pingable"
I know how to write the IF condition part here by checking the exit status. But i need some help in looping through each lines getting field1 and printing servername(which is field2) like above if the exit statu is 0
Using korn shell, i need to write this script . Will this require a loop inside a loop ?
for iplist in `cat mylist.txt | cut -d: -f1`
do
if
#i will do my logic using vsping in IF condition here
#it will be something like
# vsping ip . if exit status = 0 , then pingable
fi
done
IFS is a special variable controlling what characters your shell splits on. It defaults to any whitespace. By putting it outside the loop instead of where I put it, you're making that apply to all shell statements, not just read. Whatever "MY commands" was probably contained variables you forgot to quote...
IFS=":" belongs directly before read, while IFS=":" read , not on a line of its own.