public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Problems with shell script (bash)
@ 1997-08-31 13:43 Yung Hsien
  1997-09-01 18:30 ` Mikey
  0 siblings, 1 reply; 2+ messages in thread
From: Yung Hsien @ 1997-08-31 13:43 UTC (permalink / raw)
  To: gnu-win32

Hello,

I'm having a problem with bash, tr, or echo... I'm not sure who the culprit
is here. In any case, here's a short script:

>#!/bin/sh
>
>OPTIONS="A B C"
>
>FOUND="FALSE"
>FIND=`echo a | tr '[a-z]' '[A-Z]'`
>
>echo $FIND
>
>for opt in $OPTIONS ; do
>  if [ $opt = $FIND ] ; then
>    FOUND="TRUE"
>  fi
>done
>
>echo $FOUND
>

What it should echo at the end is TRUE since 'A' is in "A B C".
But it echos FALSE. Note, that this works on my UNIX box. Also, if I say
FIND=`echo A | tr '[a-z'] '[A-Z]'` that fails also.

Thanks,
Yung Hsien
yung@connectinc.com

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Problems with shell script (bash)
  1997-08-31 13:43 Problems with shell script (bash) Yung Hsien
@ 1997-09-01 18:30 ` Mikey
  0 siblings, 0 replies; 2+ messages in thread
From: Mikey @ 1997-09-01 18:30 UTC (permalink / raw)
  To: Yung Hsien, gnu-win32

To see what's going on in a bash script do

set -xv

./scriptname

set +xv

On Thu, 28 Aug 1997 12:23:50 -0700, you wrote:

>Hello,
>
>I'm having a problem with bash, tr, or echo... I'm not sure who the culprit
>is here. In any case, here's a short script:
>
>>#!/bin/sh
>>
>>OPTIONS="A B C"
>>
>>FOUND="FALSE"
>>FIND=`echo a | tr '[a-z]' '[A-Z]'`
>>
>>echo $FIND
>>
>>for opt in $OPTIONS ; do
>>  if [ $opt = $FIND ] ; then
>>    FOUND="TRUE"
>>  fi
>>done
>>
>>echo $FOUND
>>
>
>What it should echo at the end is TRUE since 'A' is in "A B C".
>But it echos FALSE. Note, that this works on my UNIX box. Also, if I say
>FIND=`echo A | tr '[a-z'] '[A-Z]'` that fails also.
>
>Thanks,
>Yung Hsien
>yung@connectinc.com
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>

(jeffdbREMOVETHIS@netzone.com)
delete REMOVETHIS from the above to reply
         Mikey
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

end of thread, other threads:[~1997-09-01 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-31 13:43 Problems with shell script (bash) Yung Hsien
1997-09-01 18:30 ` Mikey

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).