Hi the following link
http://www.gnu.org/software/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html
either has improper or misinforming information.
The regular expression used for matching all punctuation characters in a
strings "[:punct:]" does not work on CentOS. I don't know if it works on
any other system, but it doesn't work on CentOS-6.2.
I had to do the following (and I wracked my brain for 2 days while working
through other script writing, [^0-9a-zA-Z] that's how I got a string
match against characters like the following:
~ ` ! @ # $ % ^ & * ( ) - + / , .
It's silly I know, but I don't know exactly who to report this bug to, and
unless you told me how to determine the version of grep I was using, I
wouldn't know how to find out.
I was trying to write a shell script that makes, modifies and removes DN
records from an LDAP DIT and in this particular case I needed it to
enforce password criteria. I was trying to check the number of special
characters (as presented above) as part of that plan.
I finally, used the following:
grep -o "[^0-9a-zA-Z]" <<< ${PASS} | wc -l
It works with an adjustment, that seems to be required because it is
always 1 short of the actual number of actual characters matching in the
${PASS} string being checked, so I adjusted my integer comparison
accordingly.
Warron French, MBA, SCSA