Improved validate_int

Use bash builtin's for validate_int example
This commit is contained in:
John Barker
2015-09-18 16:36:01 +01:00
parent 977badef4b
commit 9bc2991ff6

View File

@@ -91,7 +91,10 @@ For example, this is a valid validator:
function validate_int
{
echo "$1" | grep -E '^[0-9]+$'
if [[ "$1" =~ ^[0-9]+$ ]] ; then
return 0
fi
return 1
}
cmdarg 'x' 'x-option' 'some opt' '' validate_int