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: Chet Ramey
Subject: Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.
Date: Sat, 28 Dec 2013 19:17:45 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 12/27/13, 7:27 PM, address@hidden wrote:

> ""If you want an interpreted programming language instead of a shell,
> there are a bunch to choose from""
> 
> Did that. ksh. works the same and logical in any kind of unix or linux.

Yes, ksh does this.  No other historical shell does.

> btw. 
> 
> POSIX is not 40 years old.

Close to 25.  The shell and tools standard is old enough to drink: it was
first published in 1992. There was ongoing work a few years before that to
create it. They were at draft 8 or 9 when I got involved in the early 90s.

> ksh never behaved this way.
> I assume you are referring then to bsd sh or sunOS sh or similar.

The two base implementations for Posix (Posix.2 back then) were the SVR4
sh and ksh88.  The SVR4 shell ran every element of a pipeline in a
subshell; ksh88 ran the last element in the calling shell.  Since ksh88
was the only shell that didn't create a subshell, Posix could not require
that behavior.  The Posix.2 committee decided early on to make either
behavior conformant.

At this point, there were the SVR4 sh and ksh88.  Bash was early on in its
development, Ken Almquist had just written ash, zsh didn't exist, Eric
Gisin was just starting to work on pdksh (based on Charles Forsyth's v7 sh
clone), and the BRL SVR2 shell was available only to AT&T source
licensees.  There wasn't as much variation in the shell universe as you
might imagine, and ksh88 was the only shell that ran the last pipeline
element in the calling shell.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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