This is a discussion on Validate IP Address within the Shell scripting forums, part of the Development/Scripting category; I have a script, which gathers input from the user, and I want to validate an IP that is entered. ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
I have a script, which gathers input from the user, and I want to validate an IP that is entered. How can I validate an IP to make sure it is indeed an IP address without having to echo it out and run grep + regular expression on the variable?
|
| Sponsored Links | ||
|
|
|
|||
|
Got it figured out. For reference for anyone else here is what I did.
PHP Code:
|
|
|||
|
Hi,
it depends on the OS your using u need to define the hard code format for Windows/Linux for recoginsation of IP address for eg: in linux it will be always of type 192.168.12.200 like that but it changes for windows,so better have switch cases and using string format condition but i prefer regexp more it works effectively. Regards, Sanju |
|
|||
|
I made a correction in the script. Use the following for reference if anyone needs to.
PHP Code:
|
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| log mac address in squid log | sunlinux | Networking, Firewalls and Security | 1 | 09-04-2007 02:32 AM |
| Ldap authentication on the basis of Mac address | bijayant | Networking, Firewalls and Security | 0 | 08-01-2007 11:47 AM |
| Grep ip address in Linux or UNIX | sweta | Getting started tutorials | 0 | 07-27-2007 06:47 AM |
| Iptables block ip address | raj | Getting started tutorials | 0 | 05-05-2007 01:01 AM |
| airtel dns server ip address | sweta | Windows Xp/2000/2003 server administration | 2 | 10-13-2006 01:11 AM |