doc improvement for dotglob

2016-09-27 Thread Ian Kelling
The docs currently say:

"When a pattern is used for filename expansion, the character '.' at
the start of a filename or immediately following a slash must be matched
explicitly, unless the shell option 'dotglob' is set. 

The last bit should be changed to say

unless the shell option 'dotglob' is set and the file is not named '.'
or '..'. 

And dotglob's dedicated section has similar wording to change.

I looked at making a patch, but it seems the docs are repeated in
many formats, so I figured I'd just post this first.

--
Ian Kelling
https://iankelling.org



Re: doc improvement for dotglob

2016-09-27 Thread L. A. Walsh



Ian Kelling wrote:

The docs currently say:

"When a pattern is used for filename expansion, the character '.' at
the start of a filename or immediately following a slash must be matched
explicitly, unless the shell option 'dotglob' is set. 


The last bit should be changed to say

unless the shell option 'dotglob' is set and the file is not named '.'
or '..'. 
  

---
   But that's not what is supposed to happen.  It doesn't say it 
matches the
filename with "." [or ".."], but the *start* of a filename or after a "/". 
I.e., interactive shell usage should not include 
".profile/.foo/.anything" in

such expansions.





Re: doc improvement for dotglob

2016-09-27 Thread Chet Ramey
On 9/26/16 6:40 PM, Ian Kelling wrote:
> The docs currently say:
> 
> "When a pattern is used for filename expansion, the character '.' at
> the start of a filename or immediately following a slash must be matched
> explicitly, unless the shell option 'dotglob' is set. 
> 
> The last bit should be changed to say
> 
> unless the shell option 'dotglob' is set and the file is not named '.'
> or '..'. 
> 
> And dotglob's dedicated section has similar wording to change.

Thanks for the report.  There should be something in there about `.'
and `..' always having to be matched explicitly.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bad substitution when pressing [TAB]

2016-09-27 Thread Valentin Bajrami
HI,

While I was testing some variable substitution I came across this error /
unwanted behavior.

So for example:

$ printf '%s' "${/debash: ${/: bad substitution
bash: ${/: bad substitution

just after printf '%s' "${/[TAB]  this behavior is triggert.

Is this a bug?  Can anyone elaborate this?

Best,
Valentin


Re: Magnitude of Order "For Loop" performance deltas based on syntax change

2016-09-27 Thread isabella parakiss
On 9/26/16, Dan Douglas  wrote:
> Would an array of pointers to structs of key-value pairs be better
> here? It should be faster in the common cases even though it may mean
> some wasted space and reallocs depending on how you decide to grow the
> array. A linear search through an array for an index should be faster
> than linked-list traversal. https://youtu.be/YQs6IC-vgmo (why every
> std::vector implementation uses arrays, really it's true of analogues
> in most non-functional langs).
>
> Also bash itself makes it hard to use sparse arrays efficiently regardless
> of the implementation. In the case of lists, one usually wants to address
> elements by ordinal position, but both the index in `arr[index]` and the
> offset in `${arr[@]:offset:length}` don't allow it, which means random
> insertion requires a linear search despite being linked-lists. That also
> makes the "length" inconsistent with everything else that looks at the
> value of the index, though at least length does what I really wish
> offset did.
>

friendly reminder that trees exist


---
xoxo iza



[suggestion] pulling up-to-date GNU config files / config.sub & config.guess

2016-09-27 Thread Ørjan Malde
Hi,

Recently midipix target triplets were added to upstream GNU config, so I
was wondering if the config.sub file could be pulled from GNU config to
allow compilation of bash for midipix without patching


Re: doc improvement for dotglob

2016-09-27 Thread Ian Kelling
On Tue, Sep 27, 2016, at 09:41 AM, L. A. Walsh wrote:
> 
> 
> Ian Kelling wrote:
> > The docs currently say:
> >
> > "When a pattern is used for filename expansion, the character '.' at
> > the start of a filename or immediately following a slash must be matched
> > explicitly, unless the shell option 'dotglob' is set. 
> >
> > The last bit should be changed to say
> >
> > unless the shell option 'dotglob' is set and the file is not named '.'
> > or '..'. 
> >   
> ---
> But that's not what is supposed to happen.  It doesn't say it 
> matches the
> filename with "." [or ".."], but the *start* of a filename or after a
> "/". 
> I.e., interactive shell usage should not include 
> ".profile/.foo/.anything" in
> such expansions.

I'm not sure your reading it quite right. Chet gets it.
Another way of explaining it is:
dotglob does not affect the files "." and "..".



Re: doc improvement for dotglob

2016-09-27 Thread Ian Kelling
On Tue, Sep 27, 2016, at 11:08 AM, Chet Ramey wrote:
> 
> Thanks for the report.  There should be something in there about `.'
> and `..' always having to be matched explicitly.

Yw. I noticed another improvement that could be made to the
docs. How do you prefer patches? And, I assume you manually deal
with the duplication in different doc formats, is that right?