mirror of
https://github.com/serghey-rodin/vesta.git
synced 2026-07-19 23:31:50 +02:00
improved arguments validator
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user