Fix is_format_valid 'user'

Error is showing but script isn't stopping when entering an invalid user.
This commit is contained in:
Tjebbe Lievens 2016-07-29 18:35:06 +02:00 committed by GitHub
commit 8ea7cf60d3

View file

@ -465,12 +465,12 @@ sync_cron_jobs() {
is_user_format_valid() {
if [ ${#1} -eq 1 ]; then
if ! [[ "$1" =~ ^^[[:alnum:]]$ ]]; then
echo "invalid $2 format :: $1"
check_result $E_INVALID "invalid $2 format :: $1"
fi
else
if ! [[ "$1" =~ ^[[:alnum:]][-|\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]
then
echo "invalid $2 format :: $1"
check_result $E_INVALID "invalid $2 format :: $1"
fi
fi
}