On Fri, 29 Apr 2011 21:09:43 +0200 Francois Boisson <[email protected]> wrote:
> On a debian squeeze amd64. > > francois@totoche:~$ echo ABCD Directory | tr [:lower:] [:upper:] > ABCD DIRECTORY > francois@totoche:~$ cd /tmp > francois@totoche:/tmp$ echo ABCD Directory | tr [:lower:] [:upper:] > tr: construit [:upper:] et/ou [:lower:] mal aligné > francois@totoche:/tmp$ echo ABCD Directory | tr [:upper:] [:lower:] > llll lirectory > francois@totoche:/tmp$ cd > francois@totoche:~$ echo ABCD Directory | tr [:upper:] [:lower:] > abcd directory > francois@totoche:~$ Not a bug. [:upper:] and [:lower:] are also shell patterns, and if a file in the current directory matches them, they are expanded before tr sees them. My guess is that you have a file named "l" under /tmp, so what tr sees is $ echo ABCD Directory | tr l [:upper:] tr: misaligned [:upper:] and/or [:lower:] construct $ echo ABCD Directory | tr [:upper:] l llll lirectory ([:upper:], as a shell pattern, matches the characters ":", "u", "p", "e" and "r"; [:lower:] matches the characters ":", "l", "o", "w", "e" and "r"). The solution, of course, is to protect the patterns from the shell by quoting them: $ echo ABCD Directory | tr '[:lower:]' '[:upper:]' ABCD DIRECTORY -- D.
