On 3/6/15 4:54 PM, Joseph Graham wrote: > Hi, > > I don't know what the etiquette is for using this mailing list but I hope > it's OK to just get straight to the bug. > > *STEPS TO REPRODUCE* > 1. run the following commands to get everything set up: > $ touch hiya > $ mkdir '$HOME' > $ touch '$HOME/hiya' > 2. Now to reproduce the bug, type: > $ rm "$HOME/hi > THEN PRESS TAB! > It incorrectly escapes the $ resulting in: > $ rm "\$HOME/hiya" > If the user does not notice and presses return it will DELETE THE > WRONG FILE!!!
Thanks for the report. This isn't a bug; it's intentional behavior. You have presented bash with an ambiguous situation: it doesn't know whether or not you want to look for a filename in the current directory or perform variable expansion. Bash assumes you want filename completion if there's an existing pathname matching the string you typed, so it treats your scenario as filename completion rather than variable expansion. Bash has behaved this way since bash-3.0, the result of a bug report received back in July, 2004. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/