Re: "return" should not continue script execution, even if used inappropriately

2019-01-26 Thread Robert Elz
Date:Fri, 25 Jan 2019 11:41:47 -0800 From:don fong Message-ID: First, thanks for not top posting. This is much better. | no. a discussion thread can have multiple points. Of course, but that is not what I meant. By "the point" I did not mean the point of the

Re: "return" should not continue script execution, even if used inappropriately

2019-01-25 Thread don fong
> > | the "answers" have mostly been about "how to do this". > > Yes, that would be the point, wouldn't it? > no. a discussion thread can have multiple points. one point that arose was someone calling this technique (or python programmers, or both) crazy. that's the one i'm talking about, as i'

Re: "return" should not continue script execution, even if used inappropriately

2019-01-24 Thread Robert Elz
Date:Thu, 24 Jan 2019 21:12:01 -0800 From:don fong Message-ID: | that's not only an unwarranted personal attack, but it's untrue. It wasn't a personal attack - I could show you one of those (off list) if you like. As to the latter part, see below. | the "ans

Re: "return" should not continue script execution, even if used inappropriately

2019-01-24 Thread don fong
> > This is also simple. He's just not listening to the answers that's not only an unwarranted personal attack, but it's untrue. the "answers" have mostly been about "how to do this". however as i've stated multiple times: i'm not asking how to do it, i'm explaining why this technique which i

Re: "return" should not continue script execution, even if used inappropriately

2019-01-24 Thread Robert Elz
Please, both of you, stop top posting, it is anti-social, rude, and just lazy. If you go back to the original question (Jan 6) it was about a script that did "return" which did not stop the script executing whenencountered when the script was run as a command rather than via ".". It was later exp

Re: "return" should not continue script execution, even if used inappropriately

2019-01-24 Thread konsolebox
Well I didn't see any part of that discussion that describes that. Also it's a C thing. Please don't disgrace. -- konsolebox/m On Fri, Jan 25, 2019, 9:20 AM don fong Encapsulate your code in a main function and deal with it. >> > > yes, exactly. and that supposedly "crazy" python convention (it

Re: "return" should not continue script execution, even if used inappropriately

2019-01-24 Thread don fong
> > Encapsulate your code in a main function and deal with it. > yes, exactly. and that supposedly "crazy" python convention (its bash equivalent) is the best way i know of to "deal with it". On Thu, Jan 24, 2019 at 4:08 PM konsolebox wrote: > Encapsulate your code in a main function and deal

Re: "return" should not continue script execution, even if used inappropriately

2019-01-24 Thread konsolebox
Encapsulate your code in a main function and deal with it. -- konsolebox/m On Mon, Jan 21, 2019, 12:39 PM Robert Elz Date:Sun, 20 Jan 2019 17:43:04 -0800 > From:don fong > Message-ID: < > cahqakpxao-pbdr2e0tnhh_iouhlwdxq_fccbzo1gxrhpfv9...@mail.gmail.com> > > | i

Re: "return" should not continue script execution, even if used inappropriately

2019-01-21 Thread don fong
t; *From*: Greg Wooledge > *Subject*: Re: "return" should not continue script execution, even if used > inappropriately > *Date*: Mon, 21 Jan 2019 09:01:33 -0500 > -- > > On Sun, Jan 20, 2019 at 05:43:04PM -0800, don fong wrote: > >* i don't

Re: "return" should not continue script execution, even if used inappropriately

2019-01-21 Thread Bize Ma
-- *From*: Greg Wooledge *Subject*: Re: "return" should not continue script execution, even if used inappropriately *Date*: Mon, 21 Jan 2019 09:01:33 -0500 -- On Sun, Jan 20, 2019 at 05:43:04PM -0800, don fong wrote: >* i don&#

Re: "return" should not continue script execution, even if used inappropriately

2019-01-21 Thread Greg Wooledge
On Sun, Jan 20, 2019 at 05:43:04PM -0800, don fong wrote: > i don't see how this helps. the point is to have one file of code that > behaves differently depending on whether it's dotted in or executed at the > top level. https://mywiki.wooledge.org/BashFAQ/109

Re: "return" should not continue script execution, even if used inappropriately

2019-01-20 Thread Robert Elz
Date:Sun, 20 Jan 2019 17:43:04 -0800 From:don fong Message-ID: | i don't see how this helps. the point is to have one file of code that | behaves differently depending on whether it's dotted in or executed at the | top level. That's fine, if you are writing

Re: "return" should not continue script execution, even if used inappropriately

2019-01-20 Thread don fong
> > Then use the " sh -c '. script' " version instead. > i don't see how this helps. the point is to have one file of code that behaves differently depending on whether it's dotted in or executed at the top level. the script should do nothing but define stuff when dotted in; but call the main

Re: "return" should not continue script execution, even if used inappropriately

2019-01-10 Thread Robert Elz
Date:Tue, 8 Jan 2019 23:40:40 -0800 From:don fong Message-ID: | to me, your suggested wrapper script pattern seems unnatural. i don't | always want users to have to carry around 2 files (the dottable library and | the wrapper to dot it in). Then use the "

Re: "return" should not continue script execution, even if used inappropriately

2019-01-08 Thread don fong
> > df...@dfong.com said: > | there's a good reason for the "craziness": it enables individual > testing of > | the script's functions. > > For that kind of use there's a trivial solution (as there often > is for cases when people are sure that the current definition > is inadequate). > to be

Re: "return" should not continue script execution, even if used inappropriately

2019-01-07 Thread Robert Elz
Date:Mon, 7 Jan 2019 08:55:58 -0500 From:Greg Wooledge Message-ID: <20190107135558.reqhfhr5vy3ih...@eeg.ccf.org> | https://mywiki.wooledge.org/BashFAQ/109 Which only works when the shell is bash... df...@dfong.com said: | there's a good reason for the "craziness

Re: "return" should not continue script execution, even if used inappropriately

2019-01-07 Thread don fong
> > Crazy python people. > there's a good reason for the "craziness": it enables individual testing of the script's functions. it's a good idea, and IMHO it should be more widely used in "production" shell scripts. On Mon, Jan 7, 2019 at 5:56 AM Greg Wooledge wrote: > On Mon, Jan 07, 2019 at 0

Re: "return" should not continue script execution, even if used inappropriately

2019-01-07 Thread Chet Ramey
On 1/7/19 4:15 AM, Robert Elz wrote: > Date:Sun, 6 Jan 2019 17:22:36 -0500 > From:Chet Ramey > Message-ID: > > | Bash, in its default mode, considers errors from builtins non-fatal. When > | you run this in posix mode, which makes a distinction between "special"

Re: "return" should not continue script execution, even if used inappropriately

2019-01-07 Thread Greg Wooledge
On Mon, Jan 07, 2019 at 04:20:46PM +0700, Robert Elz wrote: > Date:Sun, 6 Jan 2019 16:58:59 -0600 > From:Dennis Williamson > Message-ID: > > > | You should be able to protect yourself from this by detecting if a script > | is not being sourced when it's intended

Re: "return" should not continue script execution, even if used inappropriately

2019-01-07 Thread Robert Elz
Date:Sun, 6 Jan 2019 16:58:59 -0600 From:Dennis Williamson Message-ID: | You should be able to protect yourself from this by detecting if a script | is not being sourced when it's intended that it must be and acting | accordingly. If you can work out how to d

Re: "return" should not continue script execution, even if used inappropriately

2019-01-07 Thread Robert Elz
Date:Sun, 6 Jan 2019 17:22:36 -0500 From:Chet Ramey Message-ID: | Bash, in its default mode, considers errors from builtins non-fatal. When | you run this in posix mode, which makes a distinction between "special" and | "regular" builtins, it should be a fatal

Re: "return" should not continue script execution, even if used inappropriately

2019-01-06 Thread Dennis Williamson
On Sat, Jan 5, 2019, 4:05 PM Robert Hailey > To the most excellent bash maintainers: > > I have found, what I consider to be a bug, in the following version of > bash: > * bash-4.4.23-1.fc28.x86_64 > > It is related to this error message: > * "return: can only `return' from a function or sourced s

Re: "return" should not continue script execution, even if used inappropriately

2019-01-06 Thread Chet Ramey
On 1/5/19 2:16 PM, Robert Hailey wrote: > > To the most excellent bash maintainers: > > I have found, what I consider to be a bug, in the following version of > bash: > * bash-4.4.23-1.fc28.x86_64 > > It is related to this error message: > * "return: can only `return' from a function or sourced