GNU bug report logs -
#8587
Curious bug.
Previous Next
Full log
View this message in rfc822 format
On Fri, 29 Apr 2011 21:09:43 +0200
Francois Boisson <francois <at> boisson.homeip.net> wrote:
> On a debian squeeze amd64.
>
> francois <at> totoche:~$ echo ABCD Directory | tr [:lower:] [:upper:]
> ABCD DIRECTORY
> francois <at> totoche:~$ cd /tmp
> francois <at> totoche:/tmp$ echo ABCD Directory | tr [:lower:] [:upper:]
> tr: construit [:upper:] et/ou [:lower:] mal aligné
> francois <at> totoche:/tmp$ echo ABCD Directory | tr [:upper:] [:lower:]
> llll lirectory
> francois <at> totoche:/tmp$ cd
> francois <at> totoche:~$ echo ABCD Directory | tr [:upper:] [:lower:]
> abcd directory
> francois <at> 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.
This bug report was last modified 14 years and 27 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.