Skip to content

Commit

Permalink
Improved function validmac in helperfunctions.
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyBasher committed Jul 14, 2023
1 parent bf571a5 commit 3e3e4ad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions serverfs/usr/share/linuxmuster/linbo/helperfunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# helperfunctions for linbo scripts
#
# thomas@linuxmuster.net
# 20220803
# 20230714
#

# get linuxmuster environment variables
Expand Down Expand Up @@ -51,8 +51,7 @@ validip(){

# test valid mac address syntax
validmac(){
[ `expr length $1` -ne "17" ] && return 1
(expr match "$1" '\([a-fA-F0-9-][a-fA-F0-9-]\+\(\:[a-fA-F0-9-][a-fA-F0-9-]\+\)\+$\)') &> /dev/null || return 1
[[ "$1" =~ ^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$ ]] || return 1
}

# test for valid hostname
Expand Down

0 comments on commit 3e3e4ad

Please sign in to comment.