bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I think bash logic in a loop like : while [ condition] |read somevar


From: Pierre Gaston
Subject: Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.
Date: Wed, 25 Dec 2013 08:33:33 +0200

On Tue, Dec 24, 2013 at 8:56 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:

> On Tue, Dec 24, 2013 at 07:49:28PM +0100, rens wrote:
> > I understand the technical origin of the behaviour.
> > Spend +25 yrs in unix. I am so old, that I remember fighting (at my
> > 40th)  with linux 0.79, I think....
> >
> > However, I am questioning if this is what a programming language should
> do.
>
> Stop thinking of bash as a programming language.  It is a command shell.
>
> Pipelines invoke multiple processes simultaneously.  That's their purpose:
> to run a bunch of things in parallel, with linked input/output.  Each
> process is just that -- a process.  A full-blown separate running program
> with its own PID, its own private memory and file descriptors, and so on.
>
> Moreover, the behavior of bash is constrained by 40+ years of unix shell
> history.  It implements the feature set specified by POSIX, as well as
> doing its best to be backwards compatible with older versions of itself,
> and to a much smaller extent, with ksh and sometimes even csh.
>
> If you want a shell that breaks out of that mold and does things in a
> new way, then perhaps you want zsh.
>
> If you want an interpreted programming language instead of a shell,
> there are a bunch to choose from.
>
>
If I remember correctly, POSIX allows the lastpipe behaviour.

As far as not explaining the behaviour, mr rens clearly said he was not
interested in any kind of understanding.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]