diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2015-04-07 10:38:21 +0100 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2015-04-07 10:38:21 +0100 |
commit | 0098f689f6db2db09e40af46db4420111a847a9f (patch) | |
tree | f970ebf11ff89889f2e4f1eb8da5577d5c09d21d | |
parent | cb58d09c286fa035b646d6dff9ad8eaf00084d46 (diff) | |
download | definitions-0098f689f6db2db09e40af46db4420111a847a9f.tar.gz |
moar regex
-rw-r--r-- | swift-storage.configure | 8 |
1 files 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 } |