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 62d5518179e42ea5970401b41efcbb8fc33e6bd0
parent 366289f96b2cea63126cad3060de01bba3614f51
Author: z0noxz <chris@noxz.tech>
Date:   Fri,  3 Aug 2018 22:09:08 +0200

fix correct exit codes

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

diff --git a/ip2cidr b/ip2cidr @@ -57,13 +57,13 @@ function isip { # check if input already is a CIDR if [[ $1 =~ ^[0-9]{1,2}$ && $1 -le 32 && $1 -gt 0 ]]; then echo "$1" - exit + exit 0 fi # check if input is a valid IP, then return CIDR from IP if isip $1; then ip2cidr $1 - exit + exit 0 fi # if all fails print usage @@ -76,3 +76,5 @@ LICENSE NOTICE $license EOF printf "%s\n\n" "$usage" >&2 + +exit 1