no apostrophe allowed in comment

2013-07-30 Thread Curtis Doty
When the comment is inside of a substituted process. #! /bin/bash -ex # tee >( # this is nifty echo hi there ) The above works. Whereas the below fails. #! /bin/bash -ex # tee >( # ain't this nifty echo hi there ) It burps thusly: ./foo.sh: line 7: bad substit

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chet Ramey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/30/13 10:30 AM, Chris Down wrote: > On 2013-07-30 10:18, Greg Wooledge wrote: >> After the fork() which creates the subshell, each of the two processes >> (parent and child) is still within its own instance of the function. >> The "return" command

Re: [[ ]] and [ ] tests not using the same ordering for strings.

2013-07-30 Thread Chet Ramey
On 7/30/13 6:00 AM, Jesper Brix Rosenkilde wrote: > Bash Version: 4.2 > Patch Level: 45 > Release Status: release > > Description: > When comparing ' a' with '0a' using the less than operator, using [ ] and > [[ ]] tests respectively gives different results. > > Repeat-By: > [ ' a' \< '0a' ] &&

[[ ]] and [ ] tests not using the same ordering for strings.

2013-07-30 Thread Jesper Brix Rosenkilde
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chris Down
On 2013-07-30 10:18, Greg Wooledge wrote: > After the fork() which creates the subshell, each of the two processes > (parent and child) is still within its own instance of the function. > The "return" command executed in the child causes the child's function > to terminate, but this does not cause

Re: Bug in function return statement in while subshell

2013-07-30 Thread Greg Wooledge
On Tue, Jul 30, 2013 at 04:12:07PM +0200, Roman Rakus wrote: > >>f1() { > >> : | while :; do return 3; done > >> echo $? > >> return 1 > >>} > >>echo $? > >>f1; echo $? > >>return 2 > My point is that the `return 3' in while loop is in subshell and will > not return from the function

Re: Bug in function return statement in while subshell

2013-07-30 Thread Roman Rakus
On 07/30/2013 03:50 PM, Chet Ramey wrote: On 7/29/13 1:15 PM, Roman Rakus wrote: On 07/29/2013 05:06 PM, Chet Ramey wrote: On 7/29/13 10:55 AM, Roman Rakus wrote: I didn't take a look on where the problem could be, but it is discussed on stackoverflow [1]. Looks like return builtin falsely ex

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chet Ramey
On 7/29/13 1:15 PM, Roman Rakus wrote: > On 07/29/2013 05:06 PM, Chet Ramey wrote: >> On 7/29/13 10:55 AM, Roman Rakus wrote: >>> I didn't take a look on where the problem could be, but it is discussed on >>> stackoverflow [1]. >>> >>> Looks like return builtin falsely exit execution of while loop

Re: Bug in function return statement in while subshell

2013-07-30 Thread Greg Wooledge
On Tue, Jul 30, 2013 at 01:15:59PM +0300, Pierre Gaston wrote: > >> while :;do ( while :;do break 2; done);echo foo;done > >> > >> Should this raise an error? is the break in a loop context? what's a > >> loop context? The break occurs in a subshell, which means it cannot communicate what I presum

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chris Down
On 2013-07-30 13:15, Pierre Gaston wrote: > There are 2 loop levels in my example, but break only exit the subshell. Yes, that's what I was saying. I think this should only exit the subshell (although I'd like to see break and its family returning errors when you are trying to operate on more loop

Re: Bug in function return statement in while subshell

2013-07-30 Thread Pierre Gaston
On Tue, Jul 30, 2013 at 12:51 PM, Chris Down wrote: > On 2013-07-30 12:45, Pierre Gaston wrote: >> On Tue, Jul 30, 2013 at 12:29 PM, Chris Down wrote: >> > On 2013-07-30 12:11, Pierre Gaston wrote: >> >> what about things like this: foo () ( return 1; ) >> > >> > Except in this case, the return

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chris Down
On 2013-07-30 12:45, Pierre Gaston wrote: > On Tue, Jul 30, 2013 at 12:29 PM, Chris Down wrote: > > On 2013-07-30 12:11, Pierre Gaston wrote: > >> what about things like this: foo () ( return 1; ) > > > > Except in this case, the return has a valid context. I don't see how it's > > really > > co

Re: Bug in function return statement in while subshell

2013-07-30 Thread Pierre Gaston
On Tue, Jul 30, 2013 at 12:29 PM, Chris Down wrote: > On 2013-07-30 12:11, Pierre Gaston wrote: >> what about things like this: foo () ( return 1; ) > > Except in this case, the return has a valid context. I don't see how it's > really > comparable to the represented case. It's a return in a su

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chris Down
On 2013-07-29 17:05, Chris Down wrote: > On 29 Jul 2013 17:00, "Roman Rakus" wrote: > > > > I didn't take a look on where the problem could be, but it is discussed > on stackoverflow [1]. > > > > Looks like return builtin falsely exit execution of while loop instead of > function. > > Unless I'm r

Re: Bug in function return statement in while subshell

2013-07-30 Thread Chris Down
On 2013-07-30 12:11, Pierre Gaston wrote: > what about things like this: foo () ( return 1; ) Except in this case, the return has a valid context. I don't see how it's really comparable to the represented case. pgpeaKMNUypTl.pgp Description: PGP signature

Re: Bug in function return statement in while subshell

2013-07-30 Thread Pierre Gaston
On Mon, Jul 29, 2013 at 8:15 PM, Roman Rakus wrote: > On 07/29/2013 05:06 PM, Chet Ramey wrote: >> >> On 7/29/13 10:55 AM, Roman Rakus wrote: >>> >>> I didn't take a look on where the problem could be, but it is discussed >>> on >>> stackoverflow [1]. >>> >>> Looks like return builtin falsely exit