|
|
Going one better
Since you stole that right from the man page for jot ;) , I figured I'd use my Unix-fu to whip it into something slightly better. The example given only generates passwords with all-lowercase letters. But then there's:
jot -r -c 200 33 122 | sed 's/[^[:alnum:]]//' | rs -g 0 8
This will spit out 8 character passwords consisting of mixed case and numbers. Because the sed portion acts like a filter, the output length will vary, but you can choose how many characters per word by changing the 8 at the end, and you can choose how many random characters you want "jot" to try to generate by changing the 200. If you want to allow a few extra characters like asterisk, !, ? etc, you can try adding them like this:
jot -r -c 200 33 122 | sed 's/[^[:alnum:]*+@\?!\._]//' | rs -g 0 8
In this case I'm allowing not only alphanumerics but asterisk, plus, at-sign, question mark, exclamation point, period, and underscore. (Notice that the question mark and period have to be escaped with a backslash before them as these are normally "special" characters in regular expressions, so consider those one unit in case you delete them here.) Fun stuff ;) ---
Going one better... backslashes are omitted
Please note that even though I surrounded the above code with the relevant Code tags, it STILL omitted the backslashes!!! (grrrr)
nevermind. backslashes NOT NEEDED!
Sorry for the repeated followups.
That was the bash version. tcsh here
For some reason, in the tcsh shell you have to escape the exclamation point by putting a backslash before it... so do that (or omit the !). FYI |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|