Saturday, May 4, 2024
87
rated 0 times [  87] [ 0]  / answers: 1 / hits: 25334  / 3 Years ago, thu, june 17, 2021, 9:16:07

I have this on the command line:





ln -sf $PWD/wine-


and then I hit Tab to complete the filename. In earlier versions of Ubuntu, this worked just fine to complete the wine- filename (and as a side-effect $PWD would be expanded at that time). But now it turns it in to



ln -sf $PWD/wine-


which isn't what I meant at all and doesn't complete anything as the file does not literally start with $.



How do I get completion back to the less broken behaviour?



set tells me these are my current settings:



BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor

More From » command-line

 Answers
1

I've found that bash versions >= 4.2.29 have a new direxpand shopt setting. (See man docs/bash.1 if you check out a new bash, or see bash.1 from line 8951)



If one uses Quantal Quetzal 12.10 or otherwise gets hold of (or checks out and builds) a new bash, then:



shopt -s direxpand


Gives me the behavior I want, need and love.



Workaround: In the meantime, Ctrl+Alt+E instead of Tab does what I want too. But is awkward.



BTW, There are several threads called "bash tab variable expansion question?" in gnu.bash.bug. From reading them, I found the info here.


[#42675] Friday, June 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sharall

Total Points: 407
Total Questions: 127
Total Answers: 121

Location: Saint Helena
Member since Fri, Mar 26, 2021
3 Years ago
;