Skip to content

Commit e962465

Browse files
committed
improved arguments validator
1 parent 120ee22 commit e962465

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

func/shared.func

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ format_validation() {
9999

100100
# Defining exlude mask
101101
special_chars=$(echo "$val" | \
102-
grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%]" )
102+
grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%| ]" )
103103

104104
if [[ 0 -ne "$special_chars" ]]; then
105105
echo "Error: $var out of range"
@@ -194,7 +194,7 @@ format_validation() {
194194

195195
# Defining exlude mask
196196
special_chars=$(echo "$val" | \
197-
grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%]" )
197+
grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%| ]" )
198198

199199
# Checking result
200200
if [[ 0 -ne "$special_chars" ]]; then
@@ -210,7 +210,7 @@ format_validation() {
210210

211211
# Defining exlude mask
212212
special_chars=$(echo "$val" | \
213-
grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%]" )
213+
grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%| ]" )
214214
needed_chars=$(echo "$val" | cut -s -f 2 -d '.')
215215

216216
# Checking result
@@ -227,7 +227,7 @@ format_validation() {
227227

228228
# Defining exlude mask
229229
special_chars=$(echo "$val" | \
230-
grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%]" )
230+
grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%| ]" )
231231

232232
# Checking result
233233
if [[ 0 -ne "$special_chars" ]] || [ 17 -le ${#val} ]; then

0 commit comments

Comments
 (0)