delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/24/15:20:47

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <8F23E55D511AD5119A6800D0B76FDDE11E0F68@cpex3.channelpoint.com>
From: Troy Noble <troy DOT noble AT channelpoint DOT com>
To: "'Bob McGowan'" <rmcgowan AT veritas DOT com>, cygwin AT cygwin DOT com
Subject: RE: 1.1.8: the read command in bash does not behaive the same as
in ksh
Date: Tue, 24 Apr 2001 12:35:29 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
X-Scanned-By: MIMEDefang 1.0 (http://www.roaringpenguin.com/mimedefang/)

should it not be easy to write a sed, awk , or perl script
to go through your scripts and change all instances of:

echo hi | read v1

to the more commonly acceptable form:

v1="hi"

seems like a fairly mechanical change and would make your scripts
compatible with bash.  In cases where you have echo a b c d, just
use the built-in splitting capability of sed or perl to figure
out how many you've got, then emit the right number of assignments.
If you need them passed to subprocesses, tack an "export " on
the front.

Plus it'll run faster since you're not doing the pipe thing every
time.

Just a suggestion.

Troy

-----Original Message-----
From: Bob McGowan [mailto:rmcgowan AT veritas DOT com]
Sent: Tuesday, April 24, 2001 10:47 AM
To: cygwin AT cygwin DOT com
Subject: Re: 1.1.8: the read command in bash does not behaive the same
as in ksh


From the pdksh web page (http://web.cs.mun.ca/~michael/pdksh/):

  Its weak points are that there are still a few differences from ksh88 (the
major one is that `echo hi | read x' does not set x in the current shell -
the
read is done in a separate process).


Troy Noble wrote:
> 
> pdksh is listed on the cygwin ported software links page:
> 
>
http://www.hirmke.de/software/develop/gnuwin32/cygwin/porters/Hirmke_Michael
> /GNUWin32-links.html
> 
> and more specifically:
> 
>
http://www.hirmke.de/software/develop/gnuwin32/cygwin/porters/Hirmke_Michael
> /GNUWin32-links.html#pdksh-5.2.13.x
> 
> which will ultimately get you to:
> 
>
http://www.hirmke.de/software/develop/gnuwin32/cygwin/porters/Vinschen_Corin
> na/B20/pdksh-5.2.13.x.README
> 
> -----Original Message-----
> From: Robinow, David [mailto:drobinow AT dayton DOT adroit DOT com]
> Sent: Tuesday, April 24, 2001 6:04 AM
> To: 'sdelrio AT home DOT com'; cygwin AT cygwin DOT com
> Subject: RE: 1.1.8: the read command in bash does not behaive the same
> as in ksh
> 
> You've answered your own question.  ksh does what you want. bash doesn't
> bash doesn't work that way on other unix systems either. This has nothing
> to do with cygwin. The solution is to use ksh as your shell. (No, I don't
> know
> where to get it.)
> 
> -----Original Message-----
> From: Sergio Del Rio [mailto:sdelrio AT home DOT com]
> Sent: Tuesday, April 24, 2001 2:26 AM
> To: cygwin AT cygwin DOT com
> Subject: 1.1.8: the read command in bash does not behaive the same as in
ksh
> 
> This was encountered with cygwin v1.1.8 under Windows 2000 Professional.
> 
> 
> 
> The following script executes fine on other unix systems but not with
cygwin
> and I was wondering how to get around this problem:
> 
> 
> 
> echo one two three | read v1 v2 v3
> 
> echo "v1 = ${v1}"
> 
> echo "v2 = ${v2}"
> 
> echo "v3 = ${v3}"
> 
> 
> 
> It seems that the variables are not set at all when this is done with
> cygwin.
> 
> 
> 
> I have this kind of code in many places and would really appreciate an
> answer.
> 
> 
> 
> Thanks!
> 
> 
> 
> Regards,
> 
> Sergio Del Rio
> 
> Templates 4 Business Inc.
> 
> Cell: (604) 788-3604
> 
> Fax: (604) 582-7877
> 
> 
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple

-- 
Bob McGowan
Staff Development Engineer
VERITAS Software
rmcgowan AT veritas DOT com

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

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019