KSH to Bash conversion

Randall R Schulz rschulz@teknowledge.com
Mon Mar 12 07:13:00 GMT 2001


Galen,

It looks like BASH once had a typeset built-in, but no more. However, it 
apparently never supported a "-u" option:

--====----====----====----====----====----====----====----====----====----====--
1004> help typeset
typeset: typeset [-afFrxi] [-p] name[=value] ...
     Obsolete.  See `declare'.

1005> help declare
declare: declare [-afFrxi] [-p] name[=value] ...
     Declare variables and/or give them attributes...

     The flags are:
       -a        to make NAMEs arrays (if supported)
       -f        to select from among function names only
       -F        to display function names without definitions
       -r        to make NAMEs readonly
       -x        to make NAMEs export
       -i        to make NAMEs have the `integer' attribute set
     ....
--====----====----====----====----====----====----====----====----====----====--


So, knowing no more "direct" solution here's what I'd do:

1008> "var=UpPeR- AnD LoWeR-CaSe"
1009> echo $var
UpPeR- AnD LoWeR-CaSe

1010> uVar="$(echo "$var" |tr 'a-z' 'A-Z')"
1011> echo $uVar
UPPER- AND LOWER-CASE

1012> lVar="$(echo "$var" |tr 'A-Z' 'a-z')"
1013> echo $lVar
upper- and lower-case


Randall Schluz


At 05:08 3/12/2001, you wrote:
>In KSH, I have the following statement:
>
>typeset -u TableName=$2
>
>Then, I was assured that immdiately when the parameter was
>recieved by the script it was converted to uppercase.  I need the
>corresponding statement in Bash.
>
>Thanks,
>--
>Galen Boyer


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list