Skip to main content
2 of 4
added 4 characters in body

Getting an error in the if condttion

I am just checking whether the password contains a small and capital case letter, I am getting an error at line 19.

myscript.sh

#!bin/sh

read password
condition_arr=(0 0)

if [[ $password =~ [A-Z] ]]
then
   condtion_arr[1]=1
fi


if [[ $password =~ [a-z] ]]
then
   conditionarr[0]=1
fi


if [ ${conditionarr[0]} == 1 || ${conditionarr[1]} == 1 ]
then
    printf "%s" "Yes\n "
else
    printf "%s" "No\n"
fi

error

./myscript.sh: line 19: [: missing `]'

./myscript.sh: line 19: 0: command not found

What is wrong in this code ? Can anyone tell how to fix this?