bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8587: Curious bug.


From: Eric Blake
Subject: 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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]