[Top][All Lists]

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

Weird tr bug?

From: John P. Rouillard
Subject: Weird tr bug?
Date: Thu, 09 May 2002 15:03:13 -0400

Bill Becker said:
>biteme:~$ mkdir temp
biteme:~$ cd temp
>biteme:~/temp$ echo XoX | tr [A-Z] [a-z]
>biteme:~/temp$ touch m
>biteme:~/temp$ echo XoX | tr [A-Z] [a-z]

Don't forget that [a-z] is only the literal character [, a, -, z, ],
if there is no file in the directory that matches the [a-z] glob. In
your case, the single character file 'm' matches, and the shell turns
[a-z] into m, and you see the result.

Answer, use '' around shell metacharacters.

   echo XoX | tr '[A-Z]' '[a-z]'

works for me.

                                -- rouilj
John Rouillard
My employers don't acknowledge my existence much less my opinions.

reply via email to

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