hi all


 
Thread Tools Search this Thread
Operating Systems Solaris hi all
# 1  
Old 06-11-2008
hi all

i need a script to validate a IP address entered by the user by pinging once to the entered IP in solaris..pls help me
# 2  
Old 06-11-2008
MySQL check if this helps..

Check if this helps..


Code:
#!/bin/ksh
echo input IP address
read IP
result=`echo $IP | awk -F"\." ' $0 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}$/ && $1 <=255 && $2 <= 255 && $3 <= 255 && $4 <= 255 '`
echo $result

# 3  
Old 06-11-2008
thanks

its working but i need to ping from this machine to the ip entered by the user.
# 4  
Old 06-11-2008
thanks

its working but i need to ping from this machine to the ip entered by the user.
# 5  
Old 06-11-2008
so where is the problem..? Can you send the error?
# 6  
Old 06-11-2008
nua7: That's a useless use of backticks, and also does not actually ping the address.

In fact, you should probably get a reasonable response from ping if the address is invalid.

Code:
vnix$ ping -c 1 999.999.999.999
ping: unknown host 999.999.999.999

There are multiple threads on this site about validating IP addresses; you could look at those, too. Try this canned search:
https://www.unix.com/cfmgoogle.php?cx...ress&sa=Search

PS. Please use a topic which summarizes the contents of your posting. A good topic would also automatically bring a list of "similar threads" which you could explore.

Last edited by era; 06-11-2008 at 04:31 AM.. Reason: Thread moved on while I was composing; minor updates to my text
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question