Question

If I want Bash to complete only filenames with extension .foo for the command bar I can run

$ complete -f -X '!*.foo' bar

This, however, disables completion of directories preceding a .foo file. How do I preserve completion of directories?

Was it helpful?

Solution

complete -f -o plusdirs -X '!*.foo' bar
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top