[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: |
Greg Wooledge |
Subject: |
Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed. |
Date: |
Tue, 24 Dec 2013 13:56:32 -0500 |
User-agent: |
Mutt/1.4.2.3i |
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.
Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Pierre Gaston, 2013/12/24
Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Greg Wooledge, 2013/12/24
- Message not available
- Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.,
Greg Wooledge <=
- Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Pierre Gaston, 2013/12/25
- Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Chet Ramey, 2013/12/26
- Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Suvayu Ali, 2013/12/30
- Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Chet Ramey, 2013/12/30
- Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Suvayu Ali, 2013/12/30
Message not available
Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed., Linda Walsh, 2013/12/24