|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
Hi,
In a ks script I have written, the first arg is an IP address - I decided to check the validity of this using a regular expression: #Check validity of arg1 if [[ "$1" = \b(? ?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b]] then echo "Arg1 is a valid IP address" else echo "Arg1 is invalid" fi The regex may not be the most effiecient, but it is right, anyway, when I run the script, I get: ../scriptabc.ksh: syntax error at line 17 : `(' unexpected What am I doing wrong? (I am relatively new to ksh) Thanks in advance |
|
![]() |
| Outils de la discussion | |
|
|