|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
man tr
|
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
|||
|
|||
|
>>>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. |
|
#7
|
|||
|
|||
|
* >>>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. |
|
#8
|
|||
|
|||
|
Quote:
Great post. I definitely agree. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Upper case in ksh script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|