Re: bug in tr?

[email protected] (Bob Proulx) Thu, 2 Nov 2006 21:56:59 -0700
Newsgroups gmane.comp.gnu.core-utils.bugs,gmane.comp.gnu.textutils.bugs
Message-ID <[email protected]>
[email protected] wrote:
> I working on script to alfabetical catalogue my files and...
> try this:
> 
> mkdir for_test; cd for_test
> mkdir q w e r t y u i o p a s d f g h j k l z x c v b n m
> echo WoRd | tr [:upper:] [:lower:]
> 
> any sloution?

Quote your arguments to TR so that they are not expanded by the
command shell.  You can see what they are expanding to by using the
echo command.

  echo tr [:upper:] [:lower:]
  tr e p r u e l o r w

Is that what you expect?  Probably not.

Try quoting the shell file glob characters like this:

  echo tr "[:upper:]" "[:lower:]"
  tr [:upper:] [:lower:]

  echo WoRd | tr "[:upper:]" "[:lower:]"
  word

Bob