--- Begin Message ---
Subject: |
Curious bug. |
Date: |
Fri, 29 Apr 2011 21:09:43 +0200 |
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:~$
address@hidden:/tmp/g$ tr --version
tr (GNU coreutils) 7.4
Copyright © 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 ou ultérieure
<http://gnu.org/licenses/gpl.html>. Ceci est un logiciel "libre" : vous êtes
libre de le modifier et de le redistribuer. Ce logiciel n'offre pas d'autre
garantie que celle imposée par la loi.
Écrit par Jim Meyering.
address@hidden:/tmp/g$
ii libc6 2.10.2-2 GNU C Library: Shared libraries
ii coreutils 7.4-2 The GNU core utilities
I can give you more informations if you want.
Thanks for this work.
François Boisson
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#8587: Curious bug. |
Date: |
Fri, 29 Apr 2011 14:53:35 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 |
tag 8587 notabug
close 8587
thanks
On 04/29/2011 01:09 PM, Francois Boisson 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é
Thanks for the report. However, this is not a bug in tr, but in your
usage of the shell.
Unquoted, the expression (without "") "[:lower:]" is the glob that
expands to any of the existing files: ":", "l", "o", "w", "e", "r"; and
if none of those files exists, then the glob is passed verbatim to tr.
Your results differed depending on whether the directory you were in had
files by those names.
But if you had used shell quoting, as in "'[:lower:]'", then there would
be no chance for the shell to do globbing. That is, you meant to do:
echo ABCD Directory | tr '[:lower:]' '[:upper:]'
and were only getting lucky that there weren't any one-character file
names in your first directory.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
--- End Message ---