|From:||Davis, Ricardo C.|
|Subject:||Problems with "tr -s"|
|Date:||Fri, 22 Feb 2002 17:27:04 -0500|
I'm using GNU textutils 2.0e on a RedHat Linux 6.2 box. I've written a bash script to create a password based on the following criteria: certain characters excluded, at least 10 characters long, and no repeated characters (see below). I'm using mkpasswd to create the test password and "tr" to remove the unwanted and duplicate characters.
When I run this script, it appears that none of the duplicate characters are removed. I added the last line to double-check by attempting to remove the duplicates -- without success. Is this a known bug? Thanks for your help with this issue.
Intermedia Communications - Advanced Building Networks
# suggestpw -- suggest a pretty good password
echo -n "Generating password "
until [ $pwlen -ge 11 ]
newpw=`mkpasswd -2 -l 10 -d 3 -C 3 | tr -ds 'l1O08B' '[:alnum:]'`
pwlen=`echo $newpw | wc -c`
echo -n "."
# echo -n $pwlen
echo; echo $newpw
echo "$newpw" | tr -s '[:alnum:]'
|[Prev in Thread]||Current Thread||[Next in Thread]|