<div dir="ltr"><div>Hmm, if I first run this command, the bash completion works as I'd expect in Debian 10, I guess I'll have to look into what this command does. :)<br></div><div><br></div><div><span class="gmail-comment-copy"><code>shopt -u progcomp</code></span></div><div><span class="gmail-comment-copy"><code><br></code></span></div><div><span class="gmail-comment-copy"><code><a href="https://askubuntu.com/questions/70750/how-to-get-bash-to-stop-escaping-during-tab-completion">https://askubuntu.com/questions/70750/how-to-get-bash-to-stop-escaping-during-tab-completion</a></code></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 15, 2020 at 11:24 AM Peter Knaggs <<a href="mailto:peter.knaggs@gmail.com">peter.knaggs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm having this curious behavior of bash completion <br></div><div>on Debian 10 (buster) when I'm using environment variables in the command. A simple example is, let's say I have the following file on my filesystem (reading about CVE-2020-0601):</div><div><br></div><div>$HOME/Downloads/CSA-WINDOWS-10-CRYPT-LIB-20190114.PDF</div><div><br></div><div>and I type in the following command:<br></div><div><br></div><div>cp $HOME/Downloads/CSA</div><div><br></div><div>and then I press the [TAB] key followed by the [spacebar] key followed by the [.] key, what happens is that bash completion mistakenly changes the command to:</div><div><br></div><div>cp \$HOME/Downloads/CSA-WINDOWS-10-CRYPT-LIB-20190114.PDF .</div><div><br></div><div>When I press [Enter] key, I obviously get this error:</div><div><br></div><div>cp \$HOME/Downloads/CSA-WINDOWS-10-CRYPT-LIB-20190114.PDF .<br>cp: cannot stat '$HOME/Downloads/CSA-WINDOWS-10-CRYPT-LIB-20190114.PDF': No such file or directory</div><div><br></div><div>I don't think it should be escaping the $ in this scenario ($HOME is an environment variable, after all). I guess bash is thinking that the $ is "part of the filename" so it's escaping it, but I want bash to think of this $ as a real $ because it's in front of the name of the environment variable, so it shouldn't be escaped in this case. Does bash need a code change to support this kind of thing, or is there a feature I'm missing? I think some distros don't have this issue, but I wasn't paying close enough attention to remember whether I just worked around the issue using "~" instead of $HOME, e.g.:</div><div><br></div><div>cp ~/Downloads/CSA</div><div><br></div><div>and pressing [TAB] key followed by the [spacebar] key followed by the [.] key works fine:</div><div><br></div><div>cp ~/Downloads/CSA-WINDOWS-10-CRYPT-LIB-20190114.PDF .</div><div><br></div><div>But it'd be nice to be able to use environment variables...</div><div><br></div><div>Thanks,</div><div>Peter.<br></div></div>
</blockquote></div>