GNU bug report logs -
#8587
Curious bug.
Previous Next
Full log
View this message in rfc822 format
Francois Boisson writes:
>
> On a debian squeeze amd64.
>
> francois <at> totoche:~$ echo ABCD Directory | tr [:lower:] [:upper:]
> ABCD DIRECTORY
> francois <at> totoche:~$ cd /tmp
> francois <at> totoche:/tmp$ echo ABCD Directory | tr [:lower:] [:upper:]
> tr: construit [:upper:] et/ou [:lower:] mal aligné
I can't read that error message but I can see what you did wrong.
[:upper:] is seen by the shell as a glob which matches these filenames:
:
e
p
r
u
and likewise [:lower:] matches a different set of single-character filenames.
In one directory, you don't have any files named like that. In the other
directory, you do. When the glob matches nothing, the shell passes the string
[:upper:] or [:lower:] literally as an argument to the command. That's a
design flaw in the unix shell from its early days, which nobody has the guts
to fix.
Use '[:upper:]' and '[:lower:]' to make the shell treat them as literal
strings and not globs.
Switch to zsh for better diagnostics...
% echo ABCD Directory | tr [:lower:] [:upper:]
zsh: no matches found: [:lower:]
% echo ABCD Directory | tr '[:lower:]' '[:upper:]'
ABCD DIRECTORY
--
Alan Curry
This bug report was last modified 14 years and 27 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.