Getting compgen to include slashes on directories when looking for files
问题 I'd like to get the following behavior from my custom completion Given $ mkdir foo $ touch foo faz/bar faz/baz I'd like to get this $ foo -u <tab><tab> => foo faz/ $ foo -u fa<tab><tab> => foo -u faz/ $ foo -u faz/<tab><tab> => bar baz I assumed that compgen -f f would output foo faz/ , but it outputs foo faz which doesn't help me much. Do I need to post-process the output or is there some magic combination of options to compgen that work? 回答1: I ran into the same problem. Here's the