I am working on a bash shell script that tests a string and returns true for the following:
1) Has a minimum of 8 characters
2) Has at least one letter and one number
3) Has both a lowercase and uppercase letter
Through searching I did find how to get the number of characters in a string
srtLen=$(echo -m $str | wc -m)
And the if statement would be
if [ $strLen -ge 8 ]; then
#make bool var true
fi
But I cannot find how to test and return a boolean for if a string has a lower case letter, an uppercase letter and at least one number. I don't care if each test is separate and I imagine they would be in separate if statements which is why I have mentioned in the code above a boolean variable that will be set based on the conditions.
str="foo"; echo "${#str}"