Re: A note for read builtin

2010-06-23 Thread Dr. Werner Fink
On Tue, Jun 22, 2010 at 04:50:54PM -0400, Chet Ramey wrote: > On 6/18/10 10:05 AM, Dr. Werner Fink wrote: > > > as now is visible the last command in the pipe sequence done > > in the bash is a real sub process whereas in the ksh it is not. > > > > The question rises: Why does the bash require a

Re: A note for read builtin

2010-06-22 Thread Chet Ramey
On 6/18/10 10:05 AM, Dr. Werner Fink wrote: > as now is visible the last command in the pipe sequence done > in the bash is a real sub process whereas in the ksh it is not. > > The question rises: Why does the bash require a sub peocess/shell > for the final command of a pipe sequence. It's an i

Re: A note for read builtin

2010-06-18 Thread Jan Schampera
RESEND FOR THE MAILINGLIST Britton Kerin schrieb: Which in a pipeline is supposed to be the output of the previous command, right? Its not at all obvious to me why it behaves as it does. The other subthread of this thread is about it: In Bash, all parts of a pipeline are executed in an own su

Re: A note for read builtin

2010-06-18 Thread Jan Schampera
Dr. Werner Fink wrote: The question rises: Why does the bash require a sub peocess/shell for the final command of a pipe sequence. I'd think this is more or less a design choice at first (with one or the other issue, maybe for both solutions - though I can't construct a failing case for the

Re: A note for read builtin

2010-06-18 Thread John Reiser
On 06/18/2010 07:05 AM, Dr. Werner Fink wrote: > Just a remark about the sub shell usage in bash in comparision to > ksh. Let's try: > > strace -f -o bash.strace bash -c 'echo a b | read a b' > > grep -E 'execve|clone|write\(1|read\(0' bash.strace [snip] > > and now the same with the K

Re: A note for read builtin

2010-06-18 Thread Jan Schampera
Britton Kerin wrote: How so? It seems that read always reads from the terminal even when its in a shell pipeline. This isn't correct. Read reads from STDIN by default. Regards, Jan

Re: A note for read builtin

2010-06-17 Thread Jan Schampera
Marc Herbert schrieb: From section 2.12 and from messages posted here in the past I understand that POSIX allows either one. This ambiguity reinforces the need for documentation IMHO. I agree with Greg here, it's a well known "don't". What should be documented is (maybe it is?) how pipelines

Re: A note for read builtin

2010-06-17 Thread Marc Herbert
>> - The POSIX standard does allow "echo 1 2 | read a b" to be useful >>(cf. 2.12 "Shell Execution Environment"). > Maybe the POSIX expect shell to execute the last command of pipeline > not in subshell. >From section 2.12 and from messages posted here in the past I understand that POSIX

Re: A note for read builtin

2010-06-17 Thread Roman Rakus
On 06/17/2010 10:28 AM, Marc Herbert wrote: - The POSIX standard does allow "echo 1 2 | read a b" to be useful (cf. 2.12 "Shell Execution Environment"). Some alternatives to bash actually make it useful. Standard and portability concerns definitely belong to a reference manual. Mayb

Re: A note for read builtin

2010-06-17 Thread Marc Herbert
Le 16/06/2010 19:03, Greg Wooledge a écrit : > On Wed, Jun 16, 2010 at 07:47:03PM +0200, Krzysztof ??elechowski wrote: >> The description of the read builtin [19] would benefit of the following note: >> Warning: A pipeline of the form { echo 1 2 | read a b; } is not useful. Use >> { >> read<<<"1

Re: A note for read builtin

2010-06-16 Thread Greg Wooledge
On Wed, Jun 16, 2010 at 07:47:03PM +0200, Krzysztof ??elechowski wrote: > The description of the read builtin [19] would benefit of the following note: > Warning: A pipeline of the form { echo 1 2 | read a b; } is not useful. Use > { > read<<<"1 2" a b; } instead. That kind of advice is certain