Kaynağa Gözat

improved arguments validator

Serghey Rodin 14 yıl önce
ebeveyn
işleme
e9624651d4
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 4 4
      func/shared.func

+ 4 - 4
func/shared.func

@@ -99,7 +99,7 @@ format_validation() {
 
 
         # Defining exlude mask
         # Defining exlude mask
         special_chars=$(echo "$val" | \
         special_chars=$(echo "$val" | \
-         grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%]" )
+         grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%| ]" )
 
 
         if [[ 0 -ne "$special_chars" ]]; then
         if [[ 0 -ne "$special_chars" ]]; then
             echo "Error: $var out of range"
             echo "Error: $var out of range"
@@ -194,7 +194,7 @@ format_validation() {
 
 
         # Defining exlude mask
         # Defining exlude mask
         special_chars=$(echo "$val" | \
         special_chars=$(echo "$val" | \
-            grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%]" )
+            grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%| ]" )
 
 
         # Checking result
         # Checking result
         if [[ 0 -ne "$special_chars" ]]; then
         if [[ 0 -ne "$special_chars" ]]; then
@@ -210,7 +210,7 @@ format_validation() {
 
 
         # Defining exlude mask
         # Defining exlude mask
         special_chars=$(echo "$val" | \
         special_chars=$(echo "$val" | \
-            grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%]" )
+            grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%| ]" )
         needed_chars=$(echo "$val" | cut -s -f 2 -d '.')
         needed_chars=$(echo "$val" | cut -s -f 2 -d '.')
 
 
         # Checking result
         # Checking result
@@ -227,7 +227,7 @@ format_validation() {
 
 
         # Defining exlude mask
         # Defining exlude mask
         special_chars=$(echo "$val" | \
         special_chars=$(echo "$val" | \
-            grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%]" )
+            grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%| ]" )
 
 
         # Checking result
         # Checking result
         if [[ 0 -ne "$special_chars" ]] || [ 17 -le ${#val} ]; then
         if [[ 0 -ne "$special_chars" ]] || [ 17 -le ${#val} ]; then