-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helperfunctions.sh: fixed broadcast address is not recognized as vali…
…d ip in some cases.
- Loading branch information
1 parent
058681f
commit 11346aa
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# helperfunctions for linbo scripts | ||
# | ||
# [email protected] | ||
# 20220114 | ||
# 20220803 | ||
# | ||
|
||
# get linuxmuster environment variables | ||
|
@@ -38,7 +38,15 @@ isinteger(){ | |
|
||
# check valid ip | ||
validip(){ | ||
(expr match "$1" '\(\([1-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)\.\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)\.\([0-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)\.\([1-9]\|[1-9][0-9]\|1[0-9]\{2\}\|2[0-4][0-9]\|25[0-4]\)$\)') &> /dev/null || return 1 | ||
local i | ||
if expr "$1" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then | ||
for i in 1 2 3 4; do | ||
[ $(echo "$1" | cut -d. -f$i) -gt 255 ] && return 1 | ||
done | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
} | ||
|
||
# test valid mac address syntax | ||
|