You're replying to a comment by Anirudh.

Anirudh Permalink
February 03, 2016, 11:12

Here's a barebones password validation routine template code which you can fashion per your policies. Note: the password to be validated is stored in a shell variable $passwd. YMMV.

printf '%s\n' "$passwd" |\
sed -e '
   ## password validation constraints(YMMV):
   # 1.  no whitespace
   # 2.  length >= 8
   # 3a. atleast 1 nonalpha
   # 3b. atleast 1 uppercase alpha
   # 3c. atleast 1 lowercase alpha

   /\s/bbad             # Coz, found a whitespace
   /.\{8\}/!bbad        # Coz, length < 8
   /[^a-z0-9A-Z_]/!bbad # Coz, not even 1 nonalpha present
   /[a-z]/!bbad         # Coz, not even 1 lowercase alpha present
   /[A-Z]/!bbad         # Coz, not even 1 uppercase alpha present

   # all clear
   a\
:)
   b

   :bad
   a\
:(
' 

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "floppy_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.