tr on OS X
talklists at newgeo.com
Sat Apr 3 00:46:06 PDT 2010
On Apr 2, 2010, at 10:08 PM, Brandon Allbery wrote:
> On Apr 3, 2010, at 00:31 , Scott Haneda wrote:
>> If anyone can point me to a relevant thread, I would appreciate it. I am working on a port and I keep getting a "tr: Illegal byte sequence", which is no fault of MacPorts, but the answer to this may lead me down the path of an explanation.
> This is an I18N error. If you're operating on binary data for some reason, you may want to force LANG=C so you don't get errors about illegal characters in the locale (in this case, it would almost certainly be UTF8 unless for some reason you're working in a CJK character set).
The app appears to be reading in from /dev/urandom and piping it off to tr. In my search for a solution, I have found two things about this. Other nix's have no issue with this, and they also all seem to have a working /dev/urandom as well. When I try, the app fails, changing urandom to random fixes it up to my `tr` troubles.
The `tr` issue, I was stumped, now it makes sense, as /dev/random would indeed to binary data.
Just out of curiosity, if I wanted to do something like:
$cat /dev/random | tr "a" "b"
How do I get `tr` to work? I do not see anything in the man page that would allow me to treat the binary data as correctly.
This is for a quick random password generator app that I wanted to make a Portfile of.
Thank you very much, have a good weekend.
Scott * If you contact me off list replace talklists@ with scott@ *
More information about the macports-users