How can I avoid to make the same condition at 'else' again?
Here the code:
function isvalidlogin_orig {
local username=$1
local password=$2
if [[ $password =~ $validpasswordregex ]];then
password=`getmd5 $password`
local line=(`grep -E "^${username}\s" ./protected/flatfiledatabase.txt`)
[ ${#line[@]} -gt 0 ] && [ $password == ${line[1]} ]
else
[[ $password =~ $validpasswordregex ]]
fi
}
the condition testing is the return value.
Aucun commentaire:
Enregistrer un commentaire