delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/08/18/10:56:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Wed, 18 Aug 2004 10:55:25 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: RE: read command available?
In-Reply-To: <NGBBLLIAMFLGJEOAJCCEIEBJDNAA._garbage_collector_@telia.com>
Message-ID: <Pine.GSO.4.61.0408181051060.28198@slinky.cs.nyu.edu>
References: <NGBBLLIAMFLGJEOAJCCEIEBJDNAA DOT _garbage_collector_ AT telia DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Wed, 18 Aug 2004, Hannu E K Nevalainen wrote:

> "Jarzombek, Svend" wrote:
> 
> > I am new to cygwin and try to move some ksh scripts to it.
> > I am lacking the read command, e. g. like in
> > 
> > cd /directory
> > ls | while read TEST
> > do
> >      echo $TEST
> > done
> > 
> > Is the read command somewhere available? Up to now I wasn't able to
> > find it. 
> 
> ksh:
> $ type read
> read is a shell builtin
> 
> Hmm... are you using it correctly?
> Type this at a shell prompt, enter for both lines.
> man ksh
> /^ *read \[
> 
> As I'm not familiar with ksh, so:
> -- *bash* usage example --
> #!/bin/bash
> 
> cd /
> ls | (
>   while read TEST ;do
>     echo -n $TEST 
>   done
>  )

Two points to note:

1) there's no need for the parentheses in the above expression -- in fact, 
they actually change the semantics, as the "while" will be invoked in a 
subshell.

2) the exact same command (with or without the parentheses) works in ksh, 
so I was unable to reproduce the OP's problem.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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