Dec 202012
 Posted by on December 20, 2012 at 8:12 pm bash, FAQ, Shell Scripting  Add comments

${#var}: Length of Variable’s Contents

This expansion returns the length of the expanded value of the variable:

read passwd

if [ ${#passwd} -lt 8 ]


printf “Password is too short: %d characters\n” “$#” >&2 exit 1


© Incase of any copyright infringements please check copyrights page for faster resolutions.

Leave a Reply

Show Buttons
Hide Buttons