[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8587: Curious bug.
From: |
Davide Brini |
Subject: |
bug#8587: Curious bug. |
Date: |
Fri, 29 Apr 2011 22:30:08 +0100 |
User-agent: |
|
On Fri, 29 Apr 2011 21:09:43 +0200
Francois Boisson <address@hidden> wrote:
> On a debian squeeze amd64.
>
> address@hidden:~$ echo ABCD Directory | tr [:lower:] [:upper:]
> ABCD DIRECTORY
> address@hidden:~$ cd /tmp
> address@hidden:/tmp$ echo ABCD Directory | tr [:lower:] [:upper:]
> tr: construit [:upper:] et/ou [:lower:] mal aligné
> address@hidden:/tmp$ echo ABCD Directory | tr [:upper:] [:lower:]
> llll lirectory
> address@hidden:/tmp$ cd
> address@hidden:~$ echo ABCD Directory | tr [:upper:] [:lower:]
> abcd directory
> address@hidden:~$
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.