Re: Question about the return value of 'local'

2012-12-13 Thread Francis Moreau
On Thu, Dec 13, 2012 at 3:19 PM, Chet Ramey wrote: > On 12/13/12 3:56 AM, Francis Moreau wrote: > >> I see thanks. >> >> Somehow I thought that help(1) would have given nothing more nothing >> less than what was described in the manual. > > `help' is a quick reference -- a handy shortcut. The aut

Re: Question about the return value of 'local'

2012-12-13 Thread Francis Moreau
On Thu, Dec 13, 2012 at 3:25 PM, Chet Ramey wrote: >> Actually I was asking for the case when 'local' is not used: >> >> foo=$(echo bar; false) >> >> this assignment expression returns false, and I'm wondering where >> that's documented. > > Look in the SIMPLE COMMAND EXPANSION section of the ma

Re: shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread Dan Douglas
On Thursday, December 13, 2012 09:25:02 PM DJ Mills wrote: > +(???) matches lengths that are multiples of 3, not all odd-length files. > ?+(??) would match odd-length files. My bad :) -- Dan Douglas

Re: Several issues with coprocesses regarding exit status

2012-12-13 Thread DJ Mills
On Thu, Dec 13, 2012 at 3:42 PM, Chet Ramey wrote: > It's a race to see whether or not the coprocess exits and is reaped and > cleaned up before wait executes. `false' is a very short-lived process, > doesn't require an exec, and so I would expect the child to exit very > quickly. The cleanup,

Re: shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread DJ Mills
On Thu, Dec 13, 2012 at 8:58 PM, Dan Douglas wrote: > So, +(??) actually matches strings with even length, while +(???) matches > those with odd length. +(?) matches any string with at least one character, > and any number of ?'s matches multiples of that length. > > $ ksh -c 'printf %R\\n \?' >

Re: shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread Rene Herman
On 12/14/2012 02:23 AM, gregrwm wrote: shouldn't /+(??) capture 2 letter files only? No, that matches anything beginning with a slash, followed by one or more groups of two characters. That is, followed by two characters, by 4, 6, and so on. If you had any 6 or 8 (or 9, or 12, or...) then you

Re: shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread Dan Douglas
On Thursday, December 13, 2012 07:23:11 PM gregrwm wrote: > i wanted to move a bunch of files & directories, all except a certain > few, so i figured i'd use !(this|or|that). so first i looked to see > if +(this|or|that) isolated what i expected. well perhaps i don't > understand what it's suppos

shouldn't /+(??) capture 2 letter files only?

2012-12-13 Thread gregrwm
i wanted to move a bunch of files & directories, all except a certain few, so i figured i'd use !(this|or|that). so first i looked to see if +(this|or|that) isolated what i expected. well perhaps i don't understand what it's supposed to do.. shouldn't /+(??) capture 2 letter files only? $ echo

Re: Several issues with coprocesses regarding exit status

2012-12-13 Thread Chet Ramey
On 12/11/12 2:31 PM, DJ Mills wrote: The first two have been covered in other messages. > > 3) > The first two issues aren't THAT big of a deal, because you can simply not > worry about coproc's exit status and use wait's. That's the idea; the coproc command itself returns an indication of

Re: Several issues with coprocesses regarding exit status

2012-12-13 Thread DJ Mills
On Thu, Dec 13, 2012 at 2:32 PM, Chet Ramey wrote: > On 12/12/12 3:11 AM, Andreas Schwab wrote: > > >> To reproduce: > >> if ! coproc false; then echo error1 >&2; fi; wait "$COPROC_PID" || > echo > >> error2 >&2 > > > > This has nothing to do with if but with ! which doesn't appear to work

Re: Several issues with coprocesses regarding exit status

2012-12-13 Thread Chet Ramey
On 12/12/12 3:11 AM, Andreas Schwab wrote: >> To reproduce: >> if ! coproc false; then echo error1 >&2; fi; wait "$COPROC_PID" || echo >> error2 >&2 > > This has nothing to do with if but with ! which doesn't appear to work > in this context. Correct; good catch. It was an oversight and w

Re: Question about the return value of 'local'

2012-12-13 Thread Chet Ramey
> Actually I was asking for the case when 'local' is not used: > > foo=$(echo bar; false) > > this assignment expression returns false, and I'm wondering where > that's documented. Look in the SIMPLE COMMAND EXPANSION section of the man page: If there is a command name left after expa

Re: Question about the return value of 'local'

2012-12-13 Thread Chet Ramey
On 12/13/12 3:56 AM, Francis Moreau wrote: > I see thanks. > > Somehow I thought that help(1) would have given nothing more nothing > less than what was described in the manual. `help' is a quick reference -- a handy shortcut. The authoritative documentation is still the manual page and texinfo

Re: Question about the return value of 'local'

2012-12-13 Thread Francis Moreau
On Thu, Dec 13, 2012 at 9:44 AM, Andreas Schwab wrote: > Francis Moreau writes: > >> The help of 'local' is rather obscure about the description on its return >> value: >> >> Returns success unless an invalid option is supplied, an >> error occurs, or the shell is not executing a functio

Re: Question about the return value of 'local'

2012-12-13 Thread Francis Moreau
On Thu, Dec 13, 2012 at 9:44 AM, Bob Proulx wrote: > Francis Moreau wrote: >> I found that the return value of 'local' keyword is counter intuitive >> when the value of the assignment is an expression returning false. In >> that case the return value of local is still true. For example: >> >> lo

Re: Question about the return value of 'local'

2012-12-13 Thread Andreas Schwab
Francis Moreau writes: > The help of 'local' is rather obscure about the description on its return > value: > > Returns success unless an invalid option is supplied, an > error occurs, or the shell is not executing a function. > > "an error occurs" is rather meaningless IMHO. See the ma

Re: Question about the return value of 'local'

2012-12-13 Thread Bob Proulx
Francis Moreau wrote: > I found that the return value of 'local' keyword is counter intuitive > when the value of the assignment is an expression returning false. In > that case the return value of local is still true. For example: > > local foo=$(echo bar; false) > > returns true Yes. The cr

Question about the return value of 'local'

2012-12-13 Thread Francis Moreau
Hello, I found that the return value of 'local' keyword is counter intuitive when the value of the assignment is an expression returning false. In that case the return value of local is still true. For example: local foo=$(echo bar; false) returns true whereas: foo=$(echo bar; false) retur