source:
vendor/bash/3.1-p17/examples/functions/isvalidip
Last change on this file was 3228, checked in by , 18 years ago | |
---|---|
File size: 301 bytes |
Line | |
---|---|
1 | # Thanks to Chris F. A. Johnson <c.f.a.johnson@rogers.com> for this one |
2 | is_validip() |
3 | { |
4 | case "$*" in |
5 | ""|*[!0-9.]*|*[!0-9]) return 1 ;; |
6 | esac |
7 | |
8 | local IFS=. |
9 | set -- $* |
10 | |
11 | [ $# -eq 4 ] && |
12 | [ ${1:-666} -le 255 ] && [ ${2:-666} -le 255 ] && |
13 | [ ${3:-666} -le 255 ] && [ ${4:-666} -le 254 ] |
14 | } |
Note:
See TracBrowser
for help on using the repository browser.