Re: Why escape char `:' with `\' when auto completing filenames?
On 2/20/11 10:11 PM, Clark J. Wang wrote: I just tried with a very simple ~/.bashrc: COMP_WORDBREAKS=${COMP_WORDBREAKS//[:@]/} printf '%q\n' $COMP_WORDBREAKS bind set bell-style none printf '%q\n' $COMP_WORDBREAKS When bash starts, I can see: $' \t\n\'=;|(' $'@ \t\n\'=;|(' bash-4.2# And other bind command like bind set completion-ignore-case on can also reproduce. This has to do with whether or not you run this command before readline initializes. It will be fixed in the next version of bash. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Why escape char `:' with `\' when auto completing filenames?
On 2/18/11 6:52 AM, Clark J. Wang wrote: Sth was wrong for my testing. I removed @ from COMP_WORDBREAKS but afterwards one bind command (bind set bell-style none) added @ back. I can't reproduce this: $ echo $BASH_VERSION 4.2.0(22)-maint $ echo ${COMP_WORDBREAKS} '@=;|(: $ COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} $ echo ${COMP_WORDBREAKS} '=;|(: $ bind 'set bell-style none' $ echo ${COMP_WORDBREAKS} '=;|(: Bash hostname completion is independent of the more-recently-added programmable completion, which I suspect you might be using. The default bash completion breaks words at @ and attempts to complete hostnames from its own internal list. Look at the description of HOSTFILE and the readline `complete' function in the manual page. There is a shell option (`hostcomplete') to turn this on and off. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Why escape char `:' with `\' when auto completing filenames?
On Mon, Feb 21, 2011 at 9:21 AM, Chet Ramey chet.ra...@case.edu wrote: On 2/18/11 6:52 AM, Clark J. Wang wrote: Sth was wrong for my testing. I removed @ from COMP_WORDBREAKS but afterwards one bind command (bind set bell-style none) added @ back. I can't reproduce this: $ echo $BASH_VERSION 4.2.0(22)-maint $ echo ${COMP_WORDBREAKS} '@=;|(: $ COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} $ echo ${COMP_WORDBREAKS} '=;|(: $ bind 'set bell-style none' $ echo ${COMP_WORDBREAKS} '=;|(: I can reproduce this in my 2000+ lines of bashrc but I can't if I run the command from the command line. I'll see what's the problem. Bash hostname completion is independent of the more-recently-added programmable completion, which I suspect you might be using. The default bash completion breaks words at @ and attempts to complete hostnames from its own internal list. Look at the description of HOSTFILE and the readline `complete' function in the manual page. There is a shell option (`hostcomplete') to turn this on and off. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.edu http://cnswww.cns.cwru.edu/~chet/ -- Clark J. Wang
Re: Why escape char `:' with `\' when auto completing filenames?
On Mon, Feb 21, 2011 at 9:21 AM, Chet Ramey chet.ra...@case.edu wrote: On 2/18/11 6:52 AM, Clark J. Wang wrote: Sth was wrong for my testing. I removed @ from COMP_WORDBREAKS but afterwards one bind command (bind set bell-style none) added @ back. I can't reproduce this: $ echo $BASH_VERSION 4.2.0(22)-maint $ echo ${COMP_WORDBREAKS} '@=;|(: $ COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} $ echo ${COMP_WORDBREAKS} '=;|(: $ bind 'set bell-style none' $ echo ${COMP_WORDBREAKS} '=;|(: I just tried with a very simple ~/.bashrc: COMP_WORDBREAKS=${COMP_WORDBREAKS//[:@]/} printf '%q\n' $COMP_WORDBREAKS bind set bell-style none printf '%q\n' $COMP_WORDBREAKS When bash starts, I can see: $' \t\n\'=;|(' $'@ \t\n\'=;|(' bash-4.2# And other bind command like bind set completion-ignore-case on can also reproduce. Note that I tested on Debian 6.0 (i686). Bash hostname completion is independent of the more-recently-added programmable completion, which I suspect you might be using. The default bash completion breaks words at @ and attempts to complete hostnames from its own internal list. Look at the description of HOSTFILE and the readline `complete' function in the manual page. There is a shell option (`hostcomplete') to turn this on and off. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.edu http://cnswww.cns.cwru.edu/~chet/ -- Clark J. Wang
Re: Why escape char `:' with `\' when auto completing filenames?
On 17 Feb 2011, at 23:02, Chet Ramey wrote: Clark J. Wang dearv...@gmail.com 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 to be quoted when appearing in filenames. */ rl_filename_quote_characters = \t\n\\\'@=;|()#$`?*[!:{~; /*}*/ So that's problem. I don't think @=: need to be treated specially. Any reason? They are used as word break characters during completion. That's the way it's implemented but that does not mean that's reasonable. For pete's sake. If you don't think they should be word break characters, modify the value of COMP_WORDBREAKS. For the record, @ causes a word break so you can complete hostnames more easily, = breaks so you can complete filenames on the rhs of assignment statements, and : breaks so you can complete filenames in words that look like $PATH. Are we really spending this much time on a cosmetic issue? Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it.
Re: Why escape char `:' with `\' when auto completing filenames?
Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? 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.
Re: Why escape char `:' with `\' when auto completing filenames?
On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? I don't understand what did you mean. :( 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. -- Clark (Jian) WANG
Re: Why escape char `:' with `\' when auto completing filenames?
Clark J. Wang dearv...@gmail.com writes: On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? I don't understand what did you mean. :( You just proved my point. 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.
Re: Why escape char `:' with `\' when auto completing filenames?
On Fri, Feb 18, 2011 at 6:36 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Clark J. Wang dearv...@gmail.com writes: On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab sch...@linux-m68k.org wrote: Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? I don't understand what did you mean. :( You just proved my point. It's funny? What's your point and how did I proved it? 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. -- Clark J. Wang
Re: Why escape char `:' with `\' when auto completing filenames?
On Fri, Feb 18, 2011 at 12:17 PM, Clark J. Wang dearv...@gmail.com wrote: On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab sch...@linux-m68k.org wrote: Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? I don't understand what did you mean. :( If you complete PATH, you want to be able to press tab after: PATH=/bin:/home/clark/ so that it completes /home/clark If you complete a file named 'foo:bar' you want to be able to press tab after: ls foo:b so that it completes just foo:b So how bash can decide if if it should complete just b like in the example of PATH or foo:b?
Re: Why escape char `:' with `\' when auto completing filenames?
Clark J. Wang dearv...@gmail.com writes: On Fri, Feb 18, 2011 at 6:36 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Clark J. Wang dearv...@gmail.com writes: On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab sch...@linux-m68k.org wrote: Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? I don't understand what did you mean. :( You just proved my point. It's funny? What's your point and how did I proved it? If you can't see the difference, how can readline? 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.
Re: Why escape char `:' with `\' when auto completing filenames?
On Fri, Feb 18, 2011 at 6:21 PM, Clark J. Wang dearv...@gmail.com wrote: On Fri, Feb 18, 2011 at 6:02 AM, Chet Ramey chet.ra...@case.edu wrote: For pete's sake. If you don't think they should be word break characters, modify the value of COMP_WORDBREAKS. For the record, @ causes a word break so you can complete hostnames more easily, = breaks so you can complete filenames on the rhs of assignment statements, and : breaks so you can complete filenames in words that look like $PATH. I don't understand your point. I did a testing by removing @ from COMP_WORDBREAKS and then hostname autocompletion still worked fine (e.g.: ssh user@host). Sth was wrong for my testing. I removed @ from COMP_WORDBREAKS but afterwards one bind command (bind set bell-style none) added @ back. Are we really spending this much time on a cosmetic issue? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.edu http://cnswww.cns.cwru.edu/~chet/ -- Clark (Jian) WANG -- Clark J. Wang
Re: Why escape char `:' with `\' when auto completing filenames?
On Fri, Feb 18, 2011 at 6:48 PM, Pierre Gaston pierre.gas...@gmail.comwrote: On Fri, Feb 18, 2011 at 12:17 PM, Clark J. Wang dearv...@gmail.comwrote: On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab sch...@linux-m68k.org wrote: Maarten Billemont lhun...@gmail.com writes: Why are we escaping all word break characters? rm file:name and rm file\:name are effectively identical, I'm not sure I see the need for escaping it. How do you differentiate between completing file:name and completing file:name? I don't understand what did you mean. :( If you complete PATH, you want to be able to press tab after: PATH=/bin:/home/clark/ so that it completes /home/clark If you complete a file named 'foo:bar' you want to be able to press tab after: ls foo:b so that it completes just foo:b So how bash can decide if if it should complete just b like in the example of PATH or foo:b? That makes it more clear to me. Thanks. -- Clark J. Wang
Re: Why escape char `:' with `\' when auto completing filenames?
Clark J. Wang dearv...@gmail.com 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.
Re: Why escape char `:' with `\' when auto completing filenames?
On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Clark J. Wang dearv...@gmail.com 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 - # ls TAB-- Here the `-' char will not be escaped And, even the char `)' is not by default included in COMP_WORDBREAKS it'll also be escaped with filename autocompletion. Seems like the behavior has no direct relation with the var COMP_WORDBREAKS. 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. -- Clark
Re: Why escape char `:' with `\' when auto completing filenames?
Clark J. Wang dearv...@gmail.com writes: On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Clark J. Wang dearv...@gmail.com 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 to be quoted when appearing in filenames. */ rl_filename_quote_characters = \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.
Re: Why escape char `:' with `\' when auto completing filenames?
On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Clark J. Wang dearv...@gmail.com writes: On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab sch...@linux-m68k.org wrote: Clark J. Wang dearv...@gmail.com 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 to be quoted when appearing in filenames. */ rl_filename_quote_characters = \t\n\\\'@=;|()#$`?*[!:{~; /*}*/ So that's problem. I don't think @=: need to be treated specially. Any reason? 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. -- Clark
Re: Why escape char `:' with `\' when auto completing filenames?
On Thu, Feb 17, 2011 at 9:10 PM, Andreas Schwab sch...@linux-m68k.orgwrote: Clark J. Wang dearv...@gmail.com writes: On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab sch...@linux-m68k.org wrote: Clark J. Wang dearv...@gmail.com writes: On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab sch...@linux-m68k.org wrote: Clark J. Wang dearv...@gmail.com 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 to be quoted when appearing in filenames. */ rl_filename_quote_characters = \t\n\\\'@=;|()#$`?*[!:{~; /*}*/ So that's problem. I don't think @=: need to be treated specially. Any reason? They are used as word break characters during completion. That's the way it's implemented but that does not mean that's reasonable. 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.
Re: Why escape char `:' with `\' when auto completing filenames?
Clark J. Wang dearv...@gmail.com 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 different.
Re: Why escape char `:' with `\' when auto completing filenames?
On 2/17/11 10:03 AM, Clark J. Wang wrote: Clark J. Wang dearv...@gmail.com 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 to be quoted when appearing in filenames. */ rl_filename_quote_characters = \t\n\\\'@=;|()#$`?*[!:{~; /*}*/ So that's problem. I don't think @=: need to be treated specially. Any reason? They are used as word break characters during completion. That's the way it's implemented but that does not mean that's reasonable. For pete's sake. If you don't think they should be word break characters, modify the value of COMP_WORDBREAKS. For the record, @ causes a word break so you can complete hostnames more easily, = breaks so you can complete filenames on the rhs of assignment statements, and : breaks so you can complete filenames in words that look like $PATH. Are we really spending this much time on a cosmetic issue? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/