If you use /dev/urandom with "tr" to generate random strings, you may have a problem if your shell uses a multi-byte locale. Upon encountering illegal bytes, tr will complain with "tr: Illegal byte sequence".
Setting the LC_TYPE=C before tr would do the trick:
cat /dev/urandom| LC_CTYPE=C tr -dc 'a-zA-Z0-9'
No comments:
Post a Comment