How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Linda Walsh
I am missing how to create a bash-pattern that excludes a specific pattern. I.e. to ignore any file with '-IGN-' somewhere in the filename. The best I've come up with so far has been to use shell to build a pattern, but I know it is limited in functionality. I.e.: ls !($(echo *+(-IGN-)*|tr

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Linda Walsh
On 10/28/2013 3:35 PM, Linda Walsh wrote: ls !($(echo *+(-IGN-)*|tr |)) I tried the above in a dir that has 2 files w/the pattern, and 532 w/o, and it worked, but how much of that was 'luck'? --- Slight improvement -- but still not a direct bash pattern: !($(printf %s| *+(-IGN-)*))

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Eric Blake
On 10/28/2013 04:35 PM, Linda Walsh wrote: I am missing how to create a bash-pattern that excludes a specific pattern. I.e. to ignore any file with '-IGN-' somewhere in the filename. The best I've come up with so far has been to use shell to build a pattern, but I know it is limited in

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Eric Blake
On 10/28/2013 04:41 PM, Linda Walsh wrote: On 10/28/2013 3:35 PM, Linda Walsh wrote: ls !($(echo *+(-IGN-)*|tr |)) I tried the above in a dir that has 2 files w/the pattern, and 532 w/o, and it worked, but how much of that was 'luck'? --- Slight improvement -- but still not a direct bash

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Chris F.A. Johnson
On Mon, 28 Oct 2013, Linda Walsh wrote: I am missing how to create a bash-pattern that excludes a specific pattern. I.e. to ignore any file with '-IGN-' somewhere in the filename. The best I've come up with so far has been to use shell to build a pattern, but I know it is limited in

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Linda Walsh
On 10/28/2013 3:47 PM, Chris F.A. Johnson wrote: Is there a better bash-pattern that doesn't use tr and such? ls !(*-IGN-*) --- Seems perfect... Had a slightly more complex usage (filtering MS packages) but it seems to work: ls !(*_@(en-us|none)*) Thanks!

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Linda Walsh
On 10/28/2013 3:47 PM, Eric Blake wrote: What's wrong with: !(*-IGN-*) -- Thanks 2!

Re: How to create bash-pattern to exclude a matching param in param expansionmatching?

2013-10-28 Thread Bob Proulx
Eric Blake wrote: for $var in *; do case $var in *-IGN-*) ;; *) # whatever you wanted on the remaining files ;; esac done A couple of minor syntax errors in the above. But we know it is simply that perl influence that dragged you that way. :-) This is a typical pattern

[PATCH] bash: fix error path of getc_with_restart()

2013-10-28 Thread Yong Zhang
When read() returns with ERROR, local_bufused will be set to -1; and if we return with local_bufused == -1 left, the next time we call getc_with_restart(), the condition (local_index == local_bufused || local_bufused == 0) will not match, thus we get random data from localbuf[] with local_index