ip2cidr

Small and simple program for converting a netmask into a CIDR
git clone git://git.noxz.tech/ip2cidr
Log | Files | Refs | README | LICENSE

commit 366289f96b2cea63126cad3060de01bba3614f51
parent 6f809ffdd935fd0bf86f6a14d3087829569bf311
Author: z0noxz <chris@noxz.tech>
Date:   Fri,  3 Aug 2018 22:05:27 +0200

fix formatting and cidr bounds {1..32} instead of {0..32}

Diffstat:
Mip2cidr | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ip2cidr b/ip2cidr @@ -48,14 +48,14 @@ function isip { ${ip[2]} -le 255 &&\ ${ip[3]} -le 255 \ ]]; then - return 0 - fi + return 0 + fi fi return 1 } # check if input already is a CIDR -if [[ $1 =~ ^[0-9]{1,2}$ && ${1} -le 32 ]]; then +if [[ $1 =~ ^[0-9]{1,2}$ && $1 -le 32 && $1 -gt 0 ]]; then echo "$1" exit fi