Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jul 2006 10:09:20 +0100 (BST)
From:      Jan Grant <jan.grant@bristol.ac.uk>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-standards@freebsd.org
Subject:   Re: stdio/sh behaviour guaranteed?
Message-ID:  <20060708100421.N41181@tribble.ilrt.bris.ac.uk>
In-Reply-To: <20060708120806.U6238@delplex.bde.org>
References:  <20060707201402.T14116@tribble.ilrt.bris.ac.uk> <20060707222343.GA10756@gothmog.pc> <20060708120806.U6238@delplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 8 Jul 2006, Bruce Evans wrote:

> Using stdio for input from pipelines in shells is almost absolutely not
> possible, since stdio normally does buffering and any buffering breaks
> pipelines since there is no way to unread characters from a pipe.  E.g.:
> 
>     printf "%s\n%s\n" foo bar |
>       sh -c 'read x; echo $$: $x; sh -c "read y; echo \$$: \$y"'

I think yours is a much better example. (I couched my question in terms 
of stdio behvaiour because it occurred to me that shell behaviour might 
be expressed (specified) in terms of it, but I'm after the shell 
behaviour in particular).

> > > And in particular, is the idiom above blessed by appropriate
> > > posix standards?
> 
> Stuff like this has to work to satisfy at least defacto standards.

That was the conclusion I was coming to.

Cheers,
jan

-- 
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661   http://ioctl.org/jan/
It's a sad fact that the word "semantics" seems to have lost all meaning.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060708100421.N41181>