The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Trouble with awk RichieFondel Shell Programming and Scripting 1 01-17-2008 07:30 AM
X trouble izua UNIX for Dummies Questions & Answers 0 01-03-2007 06:19 PM
The trouble about SU ... nulnul7 UNIX for Dummies Questions & Answers 4 10-05-2005 12:39 PM
The trouble with... zazzybob What's on Your Mind? 6 01-18-2005 06:01 AM
trouble awk UNIX Desktop for Dummies Questions & Answers 1 11-22-2002 10:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-10-2006
Mike@Work Mike@Work is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 8
Trouble with tr

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.

Any body have an explanation?
  #2 (permalink)  
Old 08-10-2006
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
echo a | tr '[a-z]' '[A-Z]'

  #3 (permalink)  
Old 08-10-2006
Mike@Work Mike@Work is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 8
Quote:
Originally Posted by vgersh99
Code:
echo a | tr '[a-z]' '[A-Z]'

Same thing

echo a | tr '[a-z]' '[A-Z]'
Z
  #4 (permalink)  
Old 08-10-2006
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
strange - works just fine on Solaris and FreeBSD.
do 'which tr' and see the path - your 'tr' might a script
  #5 (permalink)  
Old 08-10-2006
Mike@Work Mike@Work is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 8
Quote:
Originally Posted by vgersh99
strange - works just fine on Solaris and FreeBSD.
do 'which tr' and see the path - your 'tr' might a script
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

It's got me that's for sure.
  #6 (permalink)  
Old 08-10-2006
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
dunno. take a look at your 'locale' on the 'bad' sun - your 'LC_*' environment variables should match to the 'good' sun.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0