Checking the bbdebug() debug level parameter with a regular
test expression only works in bash. Using tr to filter out
digits and then checking whether anything is left achieves
the same result and is more portable.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
# Strip off the debug level and ensure it is an integer
DBGLVL=$1; shift
- if ! [[ "$DBGLVL" =~ ^[0-9]+ ]]; then
+ NONDIGITS=$(echo "$DBGLVL" | tr -d [:digit:])
+ if [ "$NONDIGITS" ]; then
bbfatal "$USAGE"
fi