Q:

always giving password not strong enough message (else condition is running)

I have been working on this function in shell scripting to take up a password from a user and check if it satisfies the criteria of being an effective password but it always says password not strong enough. The password I'm trying to use is LK@12abc.
Here is my code:
function paq()
{   

     read -p "PASSWORD :-" password

     pasq="^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$"

    if [[ $password =~ $pasq ]]; then
          echo "Valid password"
          echo "The password is:- $password" >> user1.txt
          echo "$password" >>password.txt
    else
          echo "password not strong enough"
    fi
}
paq

A:

It appears your password has to have:

3 lower case letters
2 upper case letters
2 digits
1 punctuation character
exactly 8 characters long

So, with bash glob patterns:
if [[ $password == *[a-z]*[a-z]*[a-z]* ]] &&
   [[ $password == *[A-Z]*[A-Z]* ]] &&
   [[ $password == *[0-9]*[0-9]* ]] &&
   [[ $password == *[!@#$\&*]* ]] &&
   (( ${#password} == 8 ))
then
    echo password OK
else
    echo password does not satisfy criteria
fi

I'm surprised that I need to escape the & in the 4th test

