UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 27th, 2004, 04:21 AM
bar1bar bar1bar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 bar1bar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Upper case in ksh script

Hi All,

I need to take a lowercase string and to transform it to uppercase.
Now,i saw example for sh script,but it's not working in ksh.

Can someone show me how to do it???

for example,i have the string "now" i need to transfor it to "NOW".

Thank you very much.

Reply With Quote
  #2  
Old October 27th, 2004, 04:33 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,102 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 Days 21 h 8 m
Reputation Power: 9
man tr

Reply With Quote
  #3  
Old October 27th, 2004, 11:43 AM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 6
I would argue for "man ksh" here. tr is an external program. It is not wise to invoke an external program to do what ksh can do by itself. Try:

typeset -u upper
lower="now"
upper=$lower
echo $upper

The -u attribute tells ksh to automatically upshift any letters assigned to that variable.

Reply With Quote
  #4  
Old October 28th, 2004, 07:55 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,102 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 Days 21 h 8 m
Reputation Power: 9
sure Perderabo
my only Q is:
i don't AND cannot expect my users use 'ksh'

so a stupid: echo abc|tr "[a-z]" "[A-Z]"
need more typing, but is standard unix
can be used on every *nix independent of the used shell
and ... and ... and so on

Reply With Quote
  #5  
Old October 28th, 2004, 11:53 AM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 6
Yeah, the guy who asked the question explicitly mentioned ksh. And typeset -u is required by the posix standard. It is reasonable to assume a posix-compliant shell. If you're using the old bourne shell, you're using an antique shell, and using an external program is the only option. I don't object to this based on the typing. I object to needless fork()'s and exec()'s.

Reply With Quote
  #6  
Old October 29th, 2004, 01:16 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,102 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 Days 21 h 8 m
Reputation Power: 9
>>>Yeah, the guy who asked the question explicitly mentioned ksh.
OK, IMO ksh is still not THE standard
>>>If you're using the old bourne shell, you're using an antique shell

my OS is Solaris9, not really antique but
antique bourne is just portable,
when i write a prog, i dont considere 'my' or 'your' local sys
but an at&t release7 (1978) sys installed in zambia or tibet,
it will work on 'that' , 'my' and 'your' sys
that's my goal
btw:
a well writted (antique) bourne is exactly so good as all
modern [k|ba]sh s... i read in this (and other) forums.

if performance is needed and you don't 'speak' a language
use perl.

Reply With Quote
  #7  
Old October 29th, 2004, 09:43 AM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 6
* >>>Yeah, the guy who asked the question explicitly mentioned ksh.
* OK, IMO ksh is still not THE standard

So what? Most of the ksh features, including typeset, have been accepted by the official standard bodies. If you want to ignore the advances in computer science that occurred over the last 25 years, that's your business. But don't expect the rest of the world to agree with you. You do students a grave disservice when you encourage them to live in the past.

Anyway, standard or not, this was a ksh question.

Reply With Quote
  #8  
Old June 13th, 2007, 11:01 AM
nutrapi nutrapi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 4 nutrapi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 55 sec
Reputation Power: 0
Quote:
Originally Posted by Perderabo
* >>>Yeah, the guy who asked the question explicitly mentioned ksh.
* OK, IMO ksh is still not THE standard

So what? Most of the ksh features, including typeset, have been accepted by the official standard bodies. If you want to ignore the advances in computer science that occurred over the last 25 years, that's your business. But don't expect the rest of the world to agree with you. You do students a grave disservice when you encourage them to live in the past.

Anyway, standard or not, this was a ksh question.


Great post. I definitely agree.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Upper case in ksh script


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT