您的位置:首页 > 运维架构 > Shell

shell: ip合法性检查

2013-11-28 15:35 447 查看


ipcalc -cs x.x.x.x && echo 'IP Right' || echo 'IP Error'


其中 x.x.x.x 指IPv4地址,多么神奇的命令呐


ipcalc: ip address expected
Usage: ipcalc [OPTION...]
-c, --check         Validate IP address for specified address family
-4, --ipv4          IPv4 address family (default)
-6, --ipv6          IPv6 address family
-b, --broadcast     Display calculated broadcast address
-h, --hostname      Show hostname determined via DNS
-m, --netmask       Display default netmask for IP (class A, B, or C)
-n, --network       Display network address
-p, --prefix        Display network prefix
-s, --silent        Don't ever display error messages

Help options:
-?, --help          Show this help message
--usage             Display brief usage message
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: