From 0098f689f6db2db09e40af46db4420111a847a9f Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Tue, 7 Apr 2015 10:38:21 +0100 Subject: moar regex --- swift-storage.configure | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/swift-storage.configure b/swift-storage.configure index f410bea6..078a8390 100644 --- a/swift-storage.configure +++ b/swift-storage.configure @@ -20,9 +20,13 @@ set -e export ROOT="$1" validate_number() { - if ! echo -n "$2" | grep -xq '[0-9]\+' + local name="$1" + local value="$2" + + local pattern='[0-9]+' + if ! [[ "$value" =~ $pattern ]] then - echo "'$1' must be a number" >&2 + echo "'$name' must be a number" >&2 exit 1 fi } -- cgit v1.2.1