mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
improved arguments validator
This commit is contained in:
parent
120ee22972
commit
e9624651d4
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue