0

Unix script to validate a password, the password should be at least 8 characters long, should be alphanumeric, should contain lower case and upper case letters. If any of these conditions are not met, the script should flag the password as "weak password"

3
  • 3
    What have you tried? Where's your code? What's causing the problem? We will help you fix an honest attempt to solve the problem — we won't write the code for you. One of the bigger issues with this program is "how do you get the password to the script without exposing it to snoopy programs?" Don't use a command line argument to hold the password to be tested. Commented Feb 8, 2019 at 5:16
  • Does this answer your question? stackoverflow.com/questions/20845497/… Commented Feb 8, 2019 at 7:17
  • @AndreiLupuleasa, Please find below my answer: #!/usr/bin/ksh export v_pwd=$1 l_pwd=${#v_pwd} echo ${l_pwd} echo ${v_pwd} if [[ $l_pwd -ge 8 ]]; then if [[${v_pwd} =~ [a-z] ]] && [[ ${v_pwd} =~ [A-Z] ]] && [[ ${v_pwd} =~ [0-9] ]]; then echo "valid paasswd" else echo "not a valid pwd" fi else echo "not a valid pwd" fi Commented Apr 30, 2019 at 8:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.