Re: /bin/sh => STDIN & functions, var scope messing

2013-05-31 Thread Chris Rees
On 31 May 2013 20:50, "Dan Nelson" wrote: > > In the last episode (May 31), Reid Linnemann said: > > On Fri, May 31, 2013 at 1:12 PM, Teske, Devin wrote: > > > If you're arguing we have to change sh's behavior to be more compliant, > > > jilles already quoted XCU 2.12 (our shell is well within its

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-31 Thread Dan Nelson
In the last episode (May 31), Reid Linnemann said: > On Fri, May 31, 2013 at 1:12 PM, Teske, Devin > wrote: > > If you're arguing we have to change sh's behavior to be more compliant, > > jilles already quoted XCU 2.12 (our shell is well within its right to > > run any/all lvalue/rvalue operands o

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-31 Thread Reid Linnemann
On Fri, May 31, 2013 at 1:12 PM, Teske, Devin wrote: > > If you're arguing we have to change sh's behavior to be more compliant, > jilles already quoted XCU 2.12 (our shell is well within its right to run > any/all lvalue/rvalue operands of a pipe in a sub-shell without > contradicting the guideli

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-31 Thread Teske, Devin
On May 31, 2013, at 10:59 AM, wrote: > Redirections > and >> don't put it in a subshell. Correct. (note: I made no such insinuation; But thanks for clarifying for others that perhaps were not aware). > Only pipe |, which means only STDIN affects/triggers this behaviour. > Does < operator al

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-31 Thread rank1seeker
Redirections > and >> don't put it in a subshell. Only pipe |, which means only STDIN affects/triggers this behaviour. Does < operator also does it, as it is also STDIN? Anyway, I don't care for executing binaries, but I do care if that is part of sh's code, as function is. It messes var scopes.

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-30 Thread Jilles Tjoelker
On Tue, May 28, 2013 at 11:48:47AM +0200, Václav Zeman wrote: > On 27 May 2013 21:58, Reid Linnemann wrote: > > from SH(1) > > "Note that unlike some other shells, sh executes each process in a pipe- > > line with more than one command in a subshell environment and as a > > child > > of

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-28 Thread Teske, Devin
On May 28, 2013, at 8:07 AM, Reid Linnemann wrote: > > On May 28, 2013, at 7:00 AM, Ryan Stone wrote: > >> On Tue, May 28, 2013 at 5:48 AM, Václav Zeman wrote: >> Curious. Which of the two behaviours is POSIXly correct? >> >> I believe that /bin/sh's behaviour is correct. I don't know what

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-28 Thread Reid Linnemann
On May 28, 2013, at 7:00 AM, Ryan Stone wrote: > On Tue, May 28, 2013 at 5:48 AM, Václav Zeman wrote: > Curious. Which of the two behaviours is POSIXly correct? > > I believe that /bin/sh's behaviour is correct. I don't know what shell the > manpage is referring to, but it's not bash (bash d

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-28 Thread Ryan Stone
On Tue, May 28, 2013 at 5:48 AM, Václav Zeman wrote: > Curious. Which of the two behaviours is POSIXly correct? > I believe that /bin/sh's behaviour is correct. I don't know what shell the manpage is referring to, but it's not bash (bash does the same thing in a pipeline). Perhaps it's referri

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-28 Thread Václav Zeman
On 27 May 2013 21:58, Reid Linnemann wrote: > from SH(1) > > "Note that unlike some other shells, sh executes each process in a pipe- > line with more than one command in a subshell environment and as a > child > of the sh process." > > I'm taking this to mean that redirecting to sh_f has

Re: /bin/sh => STDIN & functions, var scope messing

2013-05-27 Thread Reid Linnemann
from SH(1) "Note that unlike some other shells, sh executes each process in a pipe- line with more than one command in a subshell environment and as a child of the sh process." I'm taking this to mean that redirecting to sh_f has sh_f execute in a subshell in which global_scope_var chan

/bin/sh => STDIN & functions, var scope messing

2013-05-27 Thread rank1seeker
9.1-RELEASE-p3 --- #!/bin/sh sh_f () { global_scope_var=7463457 } yes | sh_f echo "$global_scope_var" echo ' Now without /usr/bin/yes (maybe it is STDIN issue, instead) ?!? ' sh_f echo "$global_scope_var" --- Domagoj Smolčić