asides-82
· #asides
Here’s a simple bash completion rule that I just created:
$ complete -o plusdirs -f -X '!*.vmx' vmplayer
The plusdirs option tells the complete builtin to look inside directories when trying to find matches. The -f is to match on just files and the -X specifies a pattern to filter out. In this case, I am going to filter out everything not (!) matching *.vmx. Finally, the name of the command for which this rule should apply. To sum up: match all files named *.vmx in the current directory and subdirectories when I press tab after typing vmplayer.
On a related note, setting the environment variable FIGNORE="CVS:.svn" will hide the CVS and .svn directories from command completion.