Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Freddy Vulto
On 05:15, Steven W. Orr wrote: > * Why is it needed to use the unset? > * What does unset -v do extra for me? > * What bad things could happen if I don't do the unset? Upvars makes use of unset's capability of traversing down the call-stack: a=0 b=0 c=0 d=0 e=0 _unset() { unset -v b c c d

Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Greg Wooledge
On Wed, May 25, 2011 at 05:15:28PM -0400, Steven W. Orr wrote: > In addition, I wrote (what I thought was pretty clever) a function > called glob_array: > glob_array() > { [[ snip ]] > while (( $# )) > do > arrayname=$1 > pattern="$2" > aval=( $pattern ) Looks li

Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Steven W. Orr
On 5/26/2011 8:18 AM, Greg Wooledge wrote: On Wed, May 25, 2011 at 05:15:28PM -0400, Steven W. Orr wrote: In addition, I wrote (what I thought was pretty clever) a function called glob_array: glob_array() { [[ snip ]] while (( $# )) do arrayname=$1 pattern="$2"

typo in the manual section 1.2

2011-05-26 Thread kaspars
Configuration Information [Automatically generated, do not change]: Machine: amd64 OS: freebsd8.0 Compiler: cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='amd64' -DCONF_OSTYPE='freebsd8.0' -DCONF_MACHTYPE='amd64-portbld-freebsd8.0' -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/

Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Freddy Vulto
On 09:11, Steven W. Orr wrote: > typeset $1 && upvars -a$nn $1 "${aval[@]}" > > The implication seems to be that the typeset command can fail. Is > this a reasonable thing to worry about? The idea is that a typeset - besides declaring a variable local - protects upvars from malicious variable nam

Re: Stumped on a question of scoping and unset.

2011-05-26 Thread Andreas Schwab
Freddy Vulto writes: > On 09:11, Steven W. Orr wrote: >> typeset $1 && upvars -a$nn $1 "${aval[@]}" >> >> The implication seems to be that the typeset command can fail. Is >> this a reasonable thing to worry about? > > The idea is that a typeset - besides declaring a variable local - > protects

Re: edit-and-execute-command is appropriately named, weird

2011-05-26 Thread Chet Ramey
On 5/23/11 1:05 PM, David Thomas wrote: > Hi all, > > In using bash over the years, I've been quite happy to be able to hit > ctrl-x ctrl-e to pull up an editor when my input has grown too > complicated. > > When using read -e for input, however, the behavior I find makes a lot > less sense: the

Re: [PATCH] : bash 4.2 history_search_anywhere using up-down keys

2011-05-26 Thread Chet Ramey
On 5/17/11 1:03 PM, Niraj Kulkarni wrote: > Hi all, > I have created a simple patch to have history search with up-down > arrow, to search anywhere within history string (unlike at begining in > history-search-forward/backward). Please see if it is useful. Thanks for your code submission.