bug-coreutils
[Top][All Lists]
Advanced

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

bug#17121: tr result is different when executed in /usr/bin


From: Pádraig Brady
Subject: bug#17121: tr result is different when executed in /usr/bin
Date: Thu, 27 Mar 2014 16:00:29 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

tag 17121 notabug
close 17121
stop

On 03/27/2014 09:43 AM, Benoît DUNAND-LAISIN wrote:
> Problem discovered in tr (GNU coreutils) 8.13 on a Ubuntu 12.04.
> 
> Running those commands:
> 
> cd $HOME
> echo "Linux" | tr [:upper:] [:lower:]
> 
> will result: linux
> 
> Running the same from /usr/bin:
> 
> cd /usr/bin
> echo "Linux" | tr [:upper:] [:lower:]
> 
> will result: winux
> which is obviously a bad answer.
> 
> In debug mode:
> 
> sh -xc "echo "Linux" | tr [:upper:] [:lower:]"
> + echo Linux
> + tr [:upper:] w
> winux

You debugged correctly but failed to see that
tr was getting passed the wrong options. See 'w' above.
That's because the shell is interpreting the [...]
You need to quote it:

$ echo 'Linux' | tr '[:upper:]' '[:lower:]'

thanks,
Pádraig.

p.s. cd without the $HOME changes to the home directory





reply via email to

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