Weird tr bug?

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.gnu.textutils.bugs
Message-ID <[email protected]>
Bill Becker said:
>biteme:~$ mkdir temp
biteme:~$ cd temp
>biteme:~/temp$ echo XoX | tr [A-Z] [a-z]
>xox
>biteme:~/temp$ touch m
>biteme:~/temp$ echo XoX | tr [A-Z] [a-z]
>mom

Don't forget that [a-z] is only the literal character [, a, -, z, ],
if there is no file in the directory that matches the [a-z] glob. In
your case, the single character file 'm' matches, and the shell turns
[a-z] into m, and you see the result.

Answer, use '' around shell metacharacters.


   echo XoX | tr '[A-Z]' '[a-z]'
   xox

works for me.


				-- rouilj
John Rouillard
===============================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.