public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* KSH to Bash conversion
@ 2001-03-12  5:05 Galen Boyer
  2001-03-12  6:58 ` Corinna Vinschen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Galen Boyer @ 2001-03-12  5:05 UTC (permalink / raw)
  To: cygwin

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
I like to skate on the other side of the ice.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: KSH to Bash conversion
  2001-03-12  5:05 KSH to Bash conversion Galen Boyer
@ 2001-03-12  6:58 ` Corinna Vinschen
  2001-03-12  7:13 ` Randall R Schulz
  2001-03-12  7:39 ` Ehud Karni
  2 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2001-03-12  6:58 UTC (permalink / raw)
  To: cygwin

On Mon, Mar 12, 2001 at 08:08:48AM -0500, Galen Boyer 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.

Unfortunately this is OT for this mailing list. Please ask on
a mailing list which cares for bash or shell programming in
general.

Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: KSH to Bash conversion
  2001-03-12  5:05 KSH to Bash conversion Galen Boyer
  2001-03-12  6:58 ` Corinna Vinschen
@ 2001-03-12  7:13 ` Randall R Schulz
  2001-03-12  7:39 ` Ehud Karni
  2 siblings, 0 replies; 5+ messages in thread
From: Randall R Schulz @ 2001-03-12  7:13 UTC (permalink / raw)
  To: Galen Boyer, cygwin

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: KSH to Bash conversion
  2001-03-12  5:05 KSH to Bash conversion Galen Boyer
  2001-03-12  6:58 ` Corinna Vinschen
  2001-03-12  7:13 ` Randall R Schulz
@ 2001-03-12  7:39 ` Ehud Karni
  2001-03-12 11:43   ` Galen Boyer
  2 siblings, 1 reply; 5+ messages in thread
From: Ehud Karni @ 2001-03-12  7:39 UTC (permalink / raw)
  To: galenboyer; +Cc: cygwin

> 
> In KSH, I have the following statement:
> 
> typeset -u TableName=$2

THIS IS DEFINITELY OFF TOPIC. Please don't ask more bash questions here.

Anyway since you have done your noise, here are some answers.

1. To convert to upper case you can use `tr' like this:
       TableName=`echo "$2" | tr "[a-z]" "[A-Z]"`
   Please note all the " and ` - they are essential.

2. Echo of escaped (backslashed) characters.
   Beside the -e argument you can:
   2.1  Use /bin/echo
   2.2  Set the xpg_echo option (shopt -s xpg_echo)
   2.3  Compile bash with --enable-usg-echo-default

Remember in Cygwin sh is not bash (it is ash). You can change this by
removing/renaming sh and sym-linking bash to sh (that's what I do).

I STRONGLY suggest you read the bash man page(s) carefully.

Ehud.


-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud@unix.simonwiesel.co.il

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: KSH to Bash conversion
  2001-03-12  7:39 ` Ehud Karni
@ 2001-03-12 11:43   ` Galen Boyer
  0 siblings, 0 replies; 5+ messages in thread
From: Galen Boyer @ 2001-03-12 11:43 UTC (permalink / raw)
  To: cygwin

On Mon, 12 Mar 2001, ehud@unix.simonwiesel.co.il wrote:

> I STRONGLY suggest you read the bash man page(s) carefully.

Actually, using Emacs, I searched the man page for about 1/2
hour, looking for things like, upcase, convert and ...  Actually,
I do read manuals quite religiously, but I also search manuals
quite religiously.  Almost all of the time, your efforts aren't
rewarded and newsgroups help out.  Everyonce in awhile, your
efforts aren't rewarded because you were dense.  The latter
happened here.

> THIS IS DEFINITELY OFF TOPIC. Please don't ask more bash
> questions here.

I apologize profusely.   

I am well aware that off-topic is taboo.  Be assured that this
won't happen again.

Signing off with my tail between my legs.

-- 
Galen Boyer
I like to skate on the other side of the ice.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-03-12 11:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-12  5:05 KSH to Bash conversion Galen Boyer
2001-03-12  6:58 ` Corinna Vinschen
2001-03-12  7:13 ` Randall R Schulz
2001-03-12  7:39 ` Ehud Karni
2001-03-12 11:43   ` Galen Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).