Password length validation using bash
${#var}: Length of Variable’s Contents
This expansion returns the length of the expanded value of the variable:
read passwd
if [ ${#passwd} -lt 8 ]
then
printf “Password is too short: %d characters\n” “$#” >&2 exit 1
fi
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.