Mail Archives: cygwin/2004/08/18/10:56:53
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 -