scoping bug in bash?

2007-01-09 Thread Ira Abramov
WTF? # echo $BASH_VERSION 3.1.17(1)-release # a=0 ; { a=1 ; } ; echo $a 1 # a=0 ; { a=1 ; } | cat ; echo $a 0 # a=0 ; { a=1 | cat ; } ; echo $a 0 # a=0 ; { a=1 | cat ; echo $a ; } ; echo $a 0 0 # a=0 ; { a=1 ; echo $a | cat ; } ; echo $a 1 1 # a=0 ; { a=1 ; echo $a ; } | cat ; echo $a 1 0 this ha

Re: scoping bug in bash?

2007-01-09 Thread Valery Reznic
--- Ira Abramov <[EMAIL PROTECTED]> wrote: > WTF? > > # echo $BASH_VERSION > 3.1.17(1)-release > # a=0 ; { a=1 ; } ; echo $a > 1 > # a=0 ; { a=1 ; } | cat ; echo $a > 0 > # a=0 ; { a=1 | cat ; } ; echo $a > 0 > # a=0 ; { a=1 | cat ; echo $a ; } ; echo $a > 0 > 0 > # a=0 ; { a=1 ; echo $a | cat ;

Re: scoping bug in bash?

2007-01-09 Thread Ira Abramov
odd. I can't see my original post to the list, nor your answer (only the direct answer to me). is the list manager being selective, or is my spam filter acting up? Quoting Valery Reznic, from the post of Tue, 09 Jan: > > As long as i know, pipe in the bash (sh ?) implemented > as subshell. what

Re: scoping bug in bash?

2007-01-09 Thread Peter
Things like var=value do not produce output that can be piped. One can say that the construct a=2|something is a syntax error, as opposed to a=2 something which is valid. {} do not produce a new scope, they only group instructions. Imho writing: a=1; { a=2; echo $a; }; echo $a is more corr

Re: scoping bug in bash?

2007-01-09 Thread Oleg Goldshmidt
Ira Abramov <[EMAIL PROTECTED]> writes: > WTF? > > # echo $BASH_VERSION > 3.1.17(1)-release > # a=0 ; { a=1 ; } ; echo $a > 1 > # a=0 ; { a=1 ; } | cat ; echo $a > 0 > # a=0 ; { a=1 | cat ; } ; echo $a > 0 > # a=0 ; { a=1 | cat ; echo $a ; } ; echo $a > 0 > 0 > # a=0 ; { a=1 ; echo $a | cat ; } ;

Re: scoping bug in bash?

2007-01-13 Thread Ira Abramov
Quoting Peter, from the post of Tue, 09 Jan: > > Things like var=value do not produce output that can be piped. One can so piping that to cat should do no harm, which was my point. their "no output" means thזt "cat" is getting a null string for an input via the pipe. > say that the construct a=

Re: scoping bug in bash?

2007-01-13 Thread Ira Abramov
Quoting Oleg Goldshmidt, from the post of Tue, 09 Jan: > > > > this happened to me in busybox, I thought it was a BB bug, but > > apperently it's bugwords compatible with the real BASH. > > It is not a bug, you are confused about the syntax. no, I'm confused about the result. how come {} acts lik

Re: scoping bug in bash?

2007-01-13 Thread Peter
On Sat, 13 Jan 2007, Ira Abramov wrote: Quoting Peter, from the post of Tue, 09 Jan: Things like var=value do not produce output that can be piped. One can so piping that to cat should do no harm, which was my point. their "no output" means thזt "cat" is getting a null string for an input v

Re: scoping bug in bash?

2007-01-13 Thread Oron Peled
On Sunday, 14 בJanuary 2007 00:41, Peter wrote: > Piping 'nothing' into cat in a non-interactive environment (like a > subshell in {}) should yield ^D but there is no place that says so. Imho > this is a bug (a loose end). Let's make things clear: 1. There's no 'nothing' on the left hand of the

Re: scoping bug in bash?

2007-01-13 Thread Peter
On Sun, 14 Jan 2007, Oron Peled wrote: So for an application an end-of-file is not a character, just a condition. That's what I meant with ^D. I did not imply it's a character. Peter = To unsubscribe, send mail to [EMAIL PROTEC

Re: scoping bug in bash?

2007-01-14 Thread Shachar Shemesh
Peter wrote: > > On Sun, 14 Jan 2007, Oron Peled wrote: > >> So for an application an end-of-file is not a character, just a >> condition. > > That's what I meant with ^D. I did not imply it's a character. Assuming you did not mean ^ (carrot) followed by a "D", ^D usually refers to "Ctrl-D". That o

Re: scoping bug in bash?

2007-01-14 Thread Nadav Har'El
On Sun, Jan 14, 2007, Peter wrote about "Re: scoping bug in bash?": > Piping 'nothing' into cat in a non-interactive environment (like a > subshell in {}) should yield ^D but there is no place that says so. Imho > this is a bug (a loose end). "^D" is me

Re: scoping bug in bash?

2007-01-14 Thread Shachar Shemesh
Nadav Har'El wrote: > Well, the designers of the shells disagreed with you: "a=foo" is a command, > so it can be used in a pipe. The "a=foo cmd .." is a special syntax, which > is irrelevant here (here, a=foo is not followed by a command). > I'll just add to what Nadav said. a=foo and a=foo ech

Re: scoping bug in bash?

2007-01-14 Thread Peter
On Sun, 14 Jan 2007, Shachar Shemesh wrote: Peter wrote: On Sun, 14 Jan 2007, Oron Peled wrote: So for an application an end-of-file is not a character, just a condition. That's what I meant with ^D. I did not imply it's a character. Assuming you did not mean ^ (carrot) followed by a "D"

Re: scoping bug in bash?

2007-01-14 Thread Nadav Har'El
On Sun, Jan 14, 2007, Peter wrote about "Re: scoping bug in bash?": > It's 'caret' (from carriage return) not 'carrot' At the risk of splitting hairs further, the word "caret" for the circumlex symbol (which you are right, is indeed the correc

Re: scoping bug in bash?

2007-01-14 Thread Peter
On Sun, 14 Jan 2007, Nadav Har'El wrote: : | cat Try |cat or ;|cat . ':' has the explicit meaning of empty (nop) command. Note that assignments are NOT listed under Commands in the shell manual, as opposed to let and set which are (and with good reason, since they can generate stdo