Re: [bash 4.2] In vi mode, cc failed to change the whole line

2011-02-17 Thread Mun
Hi Chet, On Thu, Feb 17, 2011 at 06:00 PM PST, Chet Ramey wrote: CR> On 2/16/11 11:43 PM, Clark J. Wang wrote: CR> > For example, in vi insert mode, I first enter a command like this: CR> > CR> > # hello world CR> > CR> > Then I press ESC and type cc, the cursor just moves to the beginning (und

Re: [bash 4.2] `declare -g' bug?

2011-02-17 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 8:45 AM, Chet Ramey wrote: > > The -g option exists solely to create variables at the global scope. The > intent is that functions be able to declare global variables with > attributes if they desire. It doesn't change the scoping rules or > variable resolution behavior.

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Eric Blake
On 02/17/2011 08:18 PM, Chet Ramey wrote: > On 2/17/11 10:12 PM, Eric Blake wrote: >> On 02/17/2011 07:48 PM, Chet Ramey wrote: >>> Consider a quick, contrived example: an administrator writes a shell >>> package (library, set of functions, whatever) that includes, among >>> other things, ways to m

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Chet Ramey
On 2/17/11 10:12 PM, Eric Blake wrote: > On 02/17/2011 07:48 PM, Chet Ramey wrote: >> Consider a quick, contrived example: an administrator writes a shell >> package (library, set of functions, whatever) that includes, among >> other things, ways to make sure that some other package is invoked with

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Eric Blake
On 02/17/2011 07:48 PM, Chet Ramey wrote: > Consider a quick, contrived example: an administrator writes a shell > package (library, set of functions, whatever) that includes, among > other things, ways to make sure that some other package is invoked with > a particular set of arguments and environ

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 11:04 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > The point is: ``Any part of the pattern may be quoted to force it to > be > > matched as a string.'' > > "it" == part of the pattern. > > So I've always been misunderstanding the bash manual (I'm not a na

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Chet Ramey
On 2/17/11 12:11 PM, Eric Blake wrote: > Consensus on today's Austin Group meeting was that since we are > interested in standardizing local variables (or at least a subset of the > 'typeset' special built-in's capabilities), this needs to be uniform > across implementations. The Austin Group wou

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Chet Ramey
On 2/17/11 9:49 AM, Steven W. Orr wrote: > On 2/16/2011 11:08 PM, Clark J. Wang wrote: >> On Thu, Feb 17, 2011 at 11:13 AM, Chet Ramey wrote: >> If I declare a variable at the top scope using -r, it will prevent me from declaring a local copy in a subroutine. This problem happens in

Re: [bash 4.2] In vi mode, cc failed to change the whole line

2011-02-17 Thread Chet Ramey
On 2/16/11 11:43 PM, Clark J. Wang wrote: > For example, in vi insert mode, I first enter a command like this: > > # hello world > > Then I press ESC and type cc, the cursor just moves to the beginning (under > the char `h') and the whole line is not emptied. If I type more chars after > cc, only

Re: [bash 4.2] `declare -g' bug?

2011-02-17 Thread Chet Ramey
On 2/16/11 5:07 AM, Clark J. Wang wrote: > See following script result: > > bash# cat declare-g.sh > #!/bin/bash > > var=global > > f1() > { > declare var=local > > f2 > echo 3.$var > } > > f2() > { > declare -g var > > echo 1.$var > var=global-changed > echo 2.$va

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Chet Ramey
On 2/17/11 10:28 AM, Greg Wooledge wrote: > On Thu, Feb 17, 2011 at 05:07:40PM +0200, Pierre Gaston wrote: >> On Thu, Feb 17, 2011 at 4:56 PM, Clark J. Wang wrote: >>> The point is: ``Any part of the pattern may be quoted to force it to be >>> matched as a string.'' And backslash is one of ba

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Chet Ramey
On 2/17/11 10:03 AM, Clark J. Wang wrote: >> "Clark J. Wang" writes: >> >>> I think char `:' is not special in bash. >> >> $ printf "%q\n" "$COMP_WORDBREAKS" >> $' \t\n"\'><=;|&(:' >> >> > I don't think that explain the issue. /* characters that need

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Chet Ramey
On 2/17/11 12:11 PM, Eric Blake wrote: >>> Description: >>> First, I already submitted this bug from work, but I didn't >>> realize that the address I sent from would not be allowed to receive >>> a response. This address will work fine. >>> >>> If I declare a variable at the top scope using

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Eric Blake
On 02/16/2011 08:13 PM, Chet Ramey wrote: > On 2/13/11 3:17 PM, ste...@syslang.net wrote: >> Configuration Information [Automatically generated, do not change]: >> Machine: i386 >> OS: linux-gnu >> Compiler: gcc >> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' >> -DCONF_OSTYPE='linu

Re: Do more testing before a release?

2011-02-17 Thread Chet Ramey
On 2/17/11 10:46 AM, Eric Blake wrote: > On 02/16/2011 09:51 PM, Clark J. Wang wrote: >> I know little about open source development process (and control?). I just >> don't know where to get the bash code (like CVS, SVN respository) before >> it's released. I think it's better to make it open to mo

Re: Do more testing before a release?

2011-02-17 Thread Chet Ramey
On 2/16/11 11:51 PM, Clark J. Wang wrote: > I know little about open source development process (and control?). I just > don't know where to get the bash code (like CVS, SVN respository) before > it's released. I think it's better to make it open to more people so > everyone can help review and tes

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Andreas Schwab
Greg Wooledge writes: > I think you're all missing what Clark's question actually is. Consider > this: > > imadev:~$ cat <<\EOF >> $PATH >> EOF > $PATH > > The use of a backslash in front of one of the characters of the > here-document's sentinel word is considered "quoting". And because the >

Re: Do more testing before a release?

2011-02-17 Thread Eric Blake
On 02/16/2011 09:51 PM, Clark J. Wang wrote: > I know little about open source development process (and control?). I just > don't know where to get the bash code (like CVS, SVN respository) before > it's released. I think it's better to make it open to more people so > everyone can help review and

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Greg Wooledge
On Thu, Feb 17, 2011 at 05:07:40PM +0200, Pierre Gaston wrote: > On Thu, Feb 17, 2011 at 4:56 PM, Clark J. Wang wrote: > > The point is: ``Any part of the pattern may be quoted to force it to be > > matched as a string.'' And backslash is one of bash's quoting chars. > aaah well the "it" in

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Andreas Schwab
"Clark J. Wang" writes: > That's the way it's implemented but that does not mean that's reasonable. So how do you suggest to solve that? Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Pierre Gaston
On Thu, Feb 17, 2011 at 4:56 PM, Clark J. Wang wrote: > On Thu, Feb 17, 2011 at 7:09 PM, Clark J. Wang wrote: > > > See following script output: > > > > bash-4.2# cat quoted-pattern.sh > > [[ .a == \.a* ]] && echo 1 # not quoted > > [[ aa =~ \.a* ]] && echo 2 # quoted > > > > [[ aa =~ \a. ]]

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 11:02 PM, Greg Wooledge wrote: > On Thu, Feb 17, 2011 at 10:56:21PM +0800, Clark J. Wang wrote: > > The point is: ``Any part of the pattern may be quoted to force it to > be > > matched as a string.'' And backslash is one of bash's quoting chars. > But > > in my examp

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 9:10 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab >wrote: > > > >> "Clark J. Wang" writes: > >> > >> > On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab < > sch...@linux-m68k.org > >> >wrote: > >> > > >> >> "Clar

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Davide Brini
On Thu, 17 Feb 2011 22:56:21 +0800 "Clark J. Wang" wrote: > On Thu, Feb 17, 2011 at 7:09 PM, Clark J. Wang wrote: > > > See following script output: > > > > bash-4.2# cat quoted-pattern.sh > > [[ .a == \.a* ]] && echo 1 # not quoted > > [[ aa =~ \.a* ]] && echo 2 # quoted > > > > [[ aa =~ \a.

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Andreas Schwab
"Clark J. Wang" writes: > The point is: ``Any part of the pattern may be quoted to force it to be > matched as a string.'' "it" == part of the pattern. > It's not clear to me what's the exact rule to tell if a pattern is > quoted or not. The rule is the same as everywhere: a quoted charac

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Greg Wooledge
On Thu, Feb 17, 2011 at 10:56:21PM +0800, Clark J. Wang wrote: > The point is: ``Any part of the pattern may be quoted to force it to be > matched as a string.'' And backslash is one of bash's quoting chars. But > in my examples, a pattern with `\' in it sometimes is considered to be > quoted

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 7:09 PM, Clark J. Wang wrote: > See following script output: > > bash-4.2# cat quoted-pattern.sh > [[ .a == \.a* ]] && echo 1 # not quoted > [[ aa =~ \.a* ]] && echo 2 # quoted > > [[ aa =~ \a. ]] && echo 3 # not quoted > [[ aa =~ \a\. ]] && echo 4 # quoted > bash-4.2

Re: typeset -r prevents local variable of same name.

2011-02-17 Thread Steven W. Orr
On 2/16/2011 11:08 PM, Clark J. Wang wrote: On Thu, Feb 17, 2011 at 11:13 AM, Chet Ramey wrote: If I declare a variable at the top scope using -r, it will prevent me from declaring a local copy in a subroutine. This problem happens in this version of bash as well as in bash4 under Fedora 14.

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Pierre Gaston
=~ \a. matches an a followed by any char On Thu, Feb 17, 2011 at 4:35 PM, Clark J. Wang wrote: > On Thu, Feb 17, 2011 at 9:20 PM, Andreas Schwab >wrote: > > > "Clark J. Wang" writes: > > > > > See following script output: > > > > > > bash-4.2# cat quoted-pattern.sh > > > [[ .a == \.a* ]] && ec

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Davide Brini
On Thu, 17 Feb 2011 22:35:31 +0800 "Clark J. Wang" wrote: > On Thu, Feb 17, 2011 at 9:20 PM, Andreas Schwab > wrote: > > > "Clark J. Wang" writes: > > > > > See following script output: > > > > > > bash-4.2# cat quoted-pattern.sh > > > [[ .a == \.a* ]] && echo 1 # not quoted > > > [[ aa =~ \.a

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 9:20 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > See following script output: > > > > bash-4.2# cat quoted-pattern.sh > > [[ .a == \.a* ]] && echo 1 # not quoted > > [[ aa =~ \.a* ]] && echo 2 # quoted > > > > [[ aa =~ \a. ]] && echo 3 # not quoted > > [[

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Andreas Schwab
"Clark J. Wang" writes: > See following script output: > > bash-4.2# cat quoted-pattern.sh > [[ .a == \.a* ]] && echo 1 # not quoted > [[ aa =~ \.a* ]] && echo 2 # quoted > > [[ aa =~ \a. ]] && echo 3 # not quoted > [[ aa =~ \a\. ]] && echo 4 # quoted > bash-4.2# bash42 quoted-pattern.sh > 1

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Andreas Schwab
"Clark J. Wang" writes: > On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab wrote: > >> "Clark J. Wang" writes: >> >> > On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab > >wrote: >> > >> >> "Clark J. Wang" writes: >> >> >> >> > I think char `:' is not special in bash. >> >> >> >> $ printf "%q\n" "

Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
See following script output: bash-4.2# cat quoted-pattern.sh [[ .a == \.a* ]] && echo 1 # not quoted [[ aa =~ \.a* ]] && echo 2 # quoted [[ aa =~ \a. ]] && echo 3 # not quoted [[ aa =~ \a\. ]] && echo 4 # quoted bash-4.2# bash42 quoted-pattern.sh 1 3 bash-4.2# >From my understanding 1 2 3 4

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab >wrote: > > > >> "Clark J. Wang" writes: > >> > >> > I think char `:' is not special in bash. > >> > >> $ printf "%q\n" "$COMP_WORDBREAKS" > >> $' \t\n"\'><=;|&

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Andreas Schwab
"Clark J. Wang" writes: > On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab wrote: > >> "Clark J. Wang" writes: >> >> > I think char `:' is not special in bash. >> >> $ printf "%q\n" "$COMP_WORDBREAKS" >> $' \t\n"\'><=;|&(:' >> >> > I don't think that explain the issue. /* characters that need

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > I think char `:' is not special in bash. > > $ printf "%q\n" "$COMP_WORDBREAKS" > $' \t\n"\'><=;|&(:' > > I don't think that explain the issue. Try like this (tested with 4.2): # COMP_WORDBREAKS+=- # touch aaa

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Andreas Schwab
"Clark J. Wang" writes: > I think char `:' is not special in bash. $ printf "%q\n" "$COMP_WORDBREAKS" $' \t\n"\'><=;|&(:' Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
For example: # touch ifcfg-eth-id-00:0c:29:b5:71:d2 # ls ifcfg After pressing the the command line will become to: # ls ifcfg-eth-id-00\:0c\:29\:b5\:71\:d2 That's a bit annoying. I think char `:' is not special in bash. Any reasonable consideration for the behavior? -- Clark