Avoid sign '$' in genereted passwords

This commit is contained in:
Christoph 2017-02-28 15:14:40 +01:00
parent 79085625c2
commit dd758254b3

View File

@ -181,13 +181,12 @@ while read email passwd ; do
## -
if [[ -z "$passwd" ]]; then
if [[ -z "$_passwd" ]]; then
passwd=`tr -cd '[:alnum:]\!@#$%' < /dev/urandom | fold -w10 | head -n1`
password_accepted=false
while ! $password_accepted ; do
passwd=`tr -cd '[:alnum:]\!@#$%' < /dev/urandom | fold -w10 | head -n1`
regex="[\!@#$%_]"
passwd=`tr -cd '[:alnum:]#_\!\%/=@-' < /dev/urandom | tr '0' 'O' | fold -w10 | head -n1`
regex="[#_\!\%/=@-]"
[[ $passwd =~ $regex ]] || continue
regex="[0123456789].*[0123456789]"
regex="[123456789].*[123456789]"
[[ $passwd =~ $regex ]] || continue
password_accepted=true
done