extglobs in case constructs

2009-10-01 Thread Martin von Gagern
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: i686-pc-linux-gnu-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/local

Re: extglobs in case constructs

2009-10-01 Thread Greg Wooledge
On Thu, Oct 01, 2009 at 04:17:33PM +0200, Martin von Gagern wrote: > #!/bin/bash > > shopt -s extglob > f() { > if [[ $v == a@(a|b|c)c ]]; then > case $v in > a@(a|b|c)c) You're using extglobs inside a function, and extglob wa

Re: extglobs in case constructs

2009-10-01 Thread Martin von Gagern
Greg Wooledge wrote: > You're using extglobs inside a function, and extglob was enabled > at the time the function was delcared. The parser parsed them at that > time, decided that they are extended globs, and therefore that's what > they are. Then why don't they work as extended globs if the ext

Re: preventing pipe reader from existing on writer exiting

2009-10-01 Thread Brian J. Murrell
On Wed, 2009-09-30 at 23:13 +0200, Andreas Schwab wrote: > > Just make sure the write side of the pipe is not closed prematurely. Hrm. Yes, of course. John's solution of having a null writer keeping it open is one way -- which I might just use. > $ (n=0; while [ $n -lt 10 ]; do cat /dev/zero;

Re: preventing pipe reader from existing on writer exiting

2009-10-01 Thread Andreas Schwab
"Brian J. Murrell" writes: > But this is where (simplified) my example using cat went sideways. :-( > In my real world use, the first cat is actually mplayer and doesn't have > the option of writing to stdout instead of a named file for this > particular use of it. Perhaps you can use /dev/stdo

Re: Strange compgen behaviour

2009-10-01 Thread Mathias Dahl
I decided to make this into a blog post to in some way contribute back to the community for all the help I got. http://muublog.blogspot.com/2009/10/bash-completion-for-playing-movies.html Enjoy! /Mathias

Re: extglobs in case constructs

2009-10-01 Thread Martin von Gagern
Martin von Gagern wrote: > I've found out that extglobs behave differently in different > constructs. To avoid syntax errors, the always have to be > enabled at parse time. > For comparison constructs like ``[[ $v == a@(a|b|c)c ]]'' this > is enough. For case construct

Buffer underflow in help builtin with narrow window

2009-10-01 Thread Chris Hall
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: i686-pc-linux-gnu-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/loc

Re: extglobs in case constructs

2009-10-01 Thread Martin von Gagern
Chet Ramey wrote: > In general, if you enable extglob before a function is parsed and leave > it on when the function is executed, you should be ok. I'm thinking about this in terms of bash completion functions. Many of them use extended globs, but they should not force a specific permanent extglo

Re: extglobs in case constructs

2009-10-01 Thread Chet Ramey
Martin von Gagern wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i686 > OS: linux-gnu > Compiler: i686-pc-linux-gnu-gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' > -DCONF_VE