Преглед изворни кода

improved arguments validator

Serghey Rodin пре 14 година
родитељ
комит
e9624651d4
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      func/shared.func

+ 4 - 4
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