From e9624651d4fccf1b1fddeddaee758070396ea448 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Thu, 15 Dec 2011 00:23:23 +0200 Subject: [PATCH] improved arguments validator --- func/shared.func | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/func/shared.func b/func/shared.func index e42a75c4..3f109d21 100644 --- a/func/shared.func +++ b/func/shared.func @@ -99,7 +99,7 @@ format_validation() { # Defining exlude mask special_chars=$(echo "$val" | \ - grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%]" ) + grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%| ]" ) if [[ 0 -ne "$special_chars" ]]; then echo "Error: $var out of range" @@ -194,7 +194,7 @@ format_validation() { # Defining exlude mask special_chars=$(echo "$val" | \ - grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%]" ) + grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%| ]" ) # Checking result if [[ 0 -ne "$special_chars" ]]; then @@ -210,7 +210,7 @@ format_validation() { # Defining exlude mask special_chars=$(echo "$val" | \ - grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%]" ) + grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%| ]" ) needed_chars=$(echo "$val" | cut -s -f 2 -d '.') # Checking result @@ -227,7 +227,7 @@ format_validation() { # Defining exlude mask special_chars=$(echo "$val" | \ - grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%]" ) + grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%| ]" ) # Checking result if [[ 0 -ne "$special_chars" ]] || [ 17 -le ${#val} ]; then