'tr' Bug

Eric Blake eblake@redhat.com
Fri Mar 11 15:47:00 GMT 2011


On 03/11/2011 08:44 AM, Tim Daneliuk wrote:
> On 3/11/2011 9:39 AM, Eric Blake said this:
>> On 03/11/2011 08:28 AM, Tim Daneliuk wrote:
>>> echo /opt/IBN/df | tr [A-Z] [a-z]
>>>
>>> produces:
>>>
>>>    /opt/xxx/df
>>
>> Let me guess - you have a file named 'x' in the current directory.
>>
>> Quote your arguments, so that the shell won't glob them:
>>
>> echo /opt/IBN/df | tr '[A-Z]' '[a-z]'
>>
>> This is not cygwin-specific.
>>
> 
> OK, then why the "correct" behavior on FreeBSD 8.2 and RHEL 5.5,
> both running bash I wonder ...

Because you didn't have a one-letter file in the current directory to
provoke glob expansion, and when a glob doesn't match, it is passed
through unchanged to tr.

To reproduce on FreeBSD or RHEL, simply 'touch x' then try again :)

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110311/6841c2e6/attachment.sig>


More information about the Cygwin mailing list