In bash, if I use [tab] to expand filenames on the command line (i.e., the command line is rewritten prior to pressing [ENTER]), is it possible to have wildcards (e.g., '*') replaced/expanded on the command line prior to pressing [ENTER]?
For my examples, say I have two files in the current directory, moo.dat and moo.sh
Normal example:
If I type...
echo moo.d[TAB]
... then my command line is replaced with...
echo moo.dat
... and I can now press [ENTER] with the confidence that I'm not matching something I don't want to match.
Problem example: But typing the following does not result in any rewrite of my command line...
echo *.dat[TAB]
(although if I press [ENTER] the expansion worked, as seen by "moo.dat" echoed to stdout. But it doesn't rewrite my command line prior to pressing [ENTER])
https://stackoverflow.com/questions/65839068/bash-tab-completion-for-pattern-starting-with January 22, 2021 at 11:53AM
没有评论:
发表评论