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

2018-03-15 Thread Greg Wooledge
On Wed, Mar 14, 2018 at 02:11:32PM -0700, Andy Chu wrote: > Shell Has a Forth-like Quality > http://www.oilshell.org/blog/2017/01/13.html Similar to http://mywiki.wooledge.org/WrapperScript :) > Pipelines Support Vectorized, Point-Free, and Imperative Style > http://www.oilshell.org/blog/2017/01/

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

2018-03-15 Thread Greg Wooledge
On Wed, Mar 14, 2018 at 06:45:15PM -0700, L A Walsh wrote: > Is relying on HERE-doc implementation something that is portable? Is it > required by POSIX? Still a few things to remember... POSIX says "no": It is unspecified whether the file descriptor is opened as a regular file, a special f

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

2018-03-15 Thread Dieter Van Eessen
Hello, >From notes from my perspective: - using the entire filesystem = 'maintaining state' : files ARE state. - all variables (commands and files) are accessible in global scope through absolute path: I think of (command line) programs as functions available in global scope - all variables(script

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Chet Ramey
On 3/14/18 1:43 PM, Stormy wrote: > Bash Version: 4.2 > Patch Level: 46 > Release Status: release > > Description: >  Section of 'case' in bash's man page says: > >  case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac >   A  case  command  first expands word, and tries

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Stormy
Thanks for the reply.  I'm not sure we are talking about the same thing.. maybe..does this example help? # case /test/test2/dir1/file in  /test/*) echo 'match';; *) echo 'nomatch';; esac match here, the expectation is to NOT match, since '/test/*' in normal shell, i.e. "ls", would NOT match tha

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread PePa
It is clear that the matching in 'case' does general pattern matching but not pathname matching. I think the bash man page should say so, clearly distinguishing different ways of matching in bash. Peter On 03/15/2018 11:15 PM, Stormy wrote: > Thanks for the reply.  I'm not sure we are talking ab

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Chet Ramey
On 3/15/18 12:15 PM, Stormy wrote: > Thanks for the reply.  I'm not sure we are talking about the same thing.. > maybe..does this example help? > # case /test/test2/dir1/file in  /test/*) echo 'match';; *) echo 'nomatch';; > esac > match > > here, the expectation is to NOT match, since '/test/*'

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Greg Wooledge
On Thu, Mar 15, 2018 at 06:50:24PM +, Stormy wrote: > if u think bash has builtin 'fnmatch' functionality, do u have an example? echo *

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Chet Ramey
On 3/15/18 2:50 PM, Stormy wrote: > Chet, > > ok, replacing 'pathname expansion' with 'pattern matching' is the right > solution, otherwise u end up with a lot of confusing explanations :) > > if u think bash has builtin 'fnmatch' functionality, do u have an example > clearly we see that 'case' a

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

2018-03-15 Thread Chet Ramey
On 3/14/18 11:49 AM, Martijn Dekker wrote: > 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/mkd

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Chet Ramey
On 3/15/18 3:26 PM, Stormy wrote: > like I said, I've already implemented, roughly 40 lines in bash, and it > seems to work, but if there is some builtin option 'shopt' or similar that > can turn the right flags you mentioned, I'm all for testing it :) There isn't. Pathname expansion is done in t

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

2018-03-15 Thread Martijn Dekker
Op 14-03-18 om 16:49 schreef Martijn Dekker: [...] > { >digits++; >result = (result * 8) + (*string++ - '0'); > - if (result > 0777) > + if (result > 0) > return -1; > } > > By the way, why does that function repeatedly check the bounds for every > dig

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread Stormy
ok, thanks for the confirmation.  now u see what I meant before.. when saying bash does not have a builtin way to call fnmatch (I meant: for path name matching), clearly bash calls fnmatch, that is obvious, but there is no way to make it do pathname matching internally. (cd, ls, will surely do i

Re: docs incorrectly mention pattern matching works like pathname expansion

2018-03-15 Thread PePa
I think bash's echo does this, it doesn't do the pattern matching like case, the slashes need to be there. You might need/want `shopt -s dotglob nullglob` Peter On 03/16/2018 05:52 AM, Stormy wrote: > ok, thanks for the confirmation.  now u see what I meant before.. when saying > bash does not h

Variables getting silently unset on redeclaration

2018-03-15 Thread dtr
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-pc-linux-gnu-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/s