Re: which paradigms does bash support

2018-03-14 Thread Pierre Gaston
On Mon, Jan 26, 2015 at 6:05 PM, Pádraig Brady wrote: > On 26/01/15 13:43, Greg Wooledge wrote: > > On Sun, Jan 25, 2015 at 08:11:41PM -0800, garegi...@gmail.com wrote: > >> As a programming language which paradigms does bash support. > Declarative, procedural, imperative? > > > > This belongs on

Re: Strange/incorrect behavior of a fake executable file

2018-03-14 Thread Greg Wooledge
On Tue, Mar 13, 2018 at 10:29:22PM -0600, Eduardo Bustamante wrote: > On Tue, Mar 13, 2018 at 7:24 PM, Vladimir Likic wrote: > > Repeat-By: > > > > $ echo junk > junk > > $ chmod +x junk > > $./junk > > --> this completely destroys my system Only if you have "." in your $PATH (or a function named

Re: which paradigms does bash support

2018-03-14 Thread Marc Weber
Excerpts from Pierre Gaston's message of 2018-03-14 09:22:45 +0200: > > On 26/01/15 13:43, Greg Wooledge wrote: > > > On Sun, Jan 25, 2015 at 08:11:41PM -0800, garegi...@gmail.com wrote: > > >> As a programming language which paradigms does bash support. > > Declarative, procedural, imperative? Rea

Re: which paradigms does bash support

2018-03-14 Thread Greg Wooledge
On Wed, Mar 14, 2018 at 10:47:09AM +0100, Marc Weber wrote: > I'm not a shell export, but I don't know how to return a list in bash. Same way you return a string, or a number, or anything else: you don't. Functions in bash aren't actually functions. They're user-definable commands (procedures).

Re: Strange/incorrect behavior of a fake executable file

2018-03-14 Thread Ilkka Virta
On 14.3. 14:43, Greg Wooledge wrote: This is ONE of the reasons why you should never put "." into your $PATH. Well, the script could just contain `./junk` or `$0` instead and it would probably work regardless of PATH. Probably just better not to write self-recursing scripts; nor to run script

[PATCH] allow file modes up to 7777 instead of 777

2018-03-14 Thread Martijn Dekker
This fixes two bugs: 1. The example 'mkdir' builtin, examples/loadables/mkdir.c, has a broken '-m' option that doesn't accept sticky/setuid/setgid. $ ./bash -c '(cd examples/loadables && make mkdir) && enable -f examples/loadables/mkdir mkdir && mkdir -m2775 foo' ['make' output sk

Re: [PATCH] allow file modes up to 7777 instead of 777

2018-03-14 Thread Martijn Dekker
Op 14-03-18 om 16:49 schreef Martijn Dekker: > While POSIX says the effect of specifying sticky/setuid/setgid bits is > unspecified[*], the 'umask' builtin should still accept these bits, as > it does in every other shell. Forgot the footnote link. Here it is: http://pubs.opengroup.org/onlinepubs/

Re: which paradigms does bash support

2018-03-14 Thread Pádraig Brady
On 14/03/18 00:22, Pierre Gaston wrote: > On Mon, Jan 26, 2015 at 6:05 PM, Pádraig Brady wrote: > >> On 26/01/15 13:43, Greg Wooledge wrote: >>> On Sun, Jan 25, 2015 at 08:11:41PM -0800, garegi...@gmail.com wrote: As a programming language which paradigms does bash support. >> Declarative, p

Re: Strange/incorrect behavior of a fake executable file

2018-03-14 Thread Eduardo Bustamante
(I've added bug-bash again) On Tue, Mar 13, 2018 at 11:32 PM, Vladimir Likic wrote: > Thanks for the quick response! > Your are correct, "." was in PATH (my bad), an it's calling itself > recursively. That went into a spiral and crashed the computer (literally). > Why is bash actually executing

Re: Strange/incorrect behavior of a fake executable file

2018-03-14 Thread Chet Ramey
On 3/14/18 4:02 PM, Eduardo Bustamante wrote: > On Tue, Mar 13, 2018 at 11:34 PM, Vladimir Likic wrote: >> Sorry, meant why is bash executing the file without hash-bang '#!' ? > > You can see the answer here: > http://git.savannah.gnu.org/cgit/bash.git/tree/execute_cmd.c?h=devel&id=bf5b8103d466f

Re: Strange/incorrect behavior of a fake executable file

2018-03-14 Thread Vladimir Likic
Hi Eduardo (and all), I was actually not doing anything useful, just playing with bash. I've got so used to putting '#! /bin/bash' at the top of the file, that I've completely forgotten that bash will attempt to execute commands even without hash-bang. Compounded to that, intuitively, I didn't exp

Re: [Help-bash] which paradigms does bash support

2018-03-14 Thread Andy Chu
I think the best way to ground this type of discussion is to show code. I wrote a couple articles last year that show shell's relation to the broader subject of programming paradigms, with example code: Shell Has a Forth-like Quality http://www.oilshell.org/blog/2017/01/13.html Pipelines Support

Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc,string} failure)

2018-03-14 Thread L A Walsh
Eduardo Bustamante wrote: On Mon, Mar 12, 2018 at 2:05 PM, L A Walsh wrote: [...] What would be the downside(s) of such an implementation? There's code out there that relies on several properties of regular files, one of them for example, that you can seek on them. I recommend again

Re: misleading error message from variable modifier

2018-03-14 Thread Chet Ramey
On 3/9/18 3:14 AM, don fong wrote: >   > my question was whether you have tests for the variable modifiers. > i don't see any.  that's the area of code i was touching, and that's why i > wrote a few tests of that area. Thank you for the inspiration. I ran the devel version of the test suite throu