Please use code tags around your codes. It preserves formatting and makes it easier to read.
Form the regex accordingly. I'm assuming passlength=
starts on a new line and has nothing after it, ie:
grep "^passlength=$" /etc/default/password
You may also wish to use the --quiet
option to grep to suppress printing of any matching lines if using it a script.