I'm not sure where to post this but it's happening on a SunOS 5.8 server so I'll try here.
I've discovered some unexpected behavior when using tr.
For example:
echo a | tr [a-z] [A-Z]
Z
echo b | tr [a-z] [A-Z]
a
echo a | tr [a-b] [A-Z]
B
echo a | tr [a-b] [A-B]
B
echo a | tr [:lower:] [:upper:]
A
BUT! is you su to the same user you get the following behavior.
echo a | tr [a-z] [A-Z]
A
echo b | tr [a-z] [A-Z]
B
echo a | tr [a-b] [A-Z]
A
echo a | tr [a-b] [A-B]
A
echo a | tr [:lower:] [:upper:]
A
The tr was being used in a script where the normal way to run the script was to login as user A and then su to user B and run the script. But someone decided to run the script with out the su part and discovered this.
I've got two SunOS 5.8 boxes that I use. I get this behavior on one box and not the other. On both boxes ll `which tr` returns
-r-xr-xr-x 1 root bin 14596 Jan 5 2000 /usr/xpg4/bin/tr
That's something to go to the Unix Admin with. When I do env | grep LC on the 'good' sun it comes up empty. If I do it on the 'bad' sun I get
LC_MONETARY=en_US.ISO8859-1
LC_TIME=en_US.ISO8859-1
LC_MESSAGES=C
LC_CTYPE=en_US.ISO8859-1
LC_COLLATE=en_US.ISO8859-1
LC_NUMERIC=en_US.ISO8859-1
Yep that works too. Specifically the LC_COLLATE variable.
I'm not an admin so I don't know how the locale get set or why it gets unset when you su to another user.