How to setup bash autocompletion for all user executable files in a certain directoryAsk Question


I have some executable files in a directory that have the '--help' option that could be processed by "complete -F _logopt", but I don't want to do this for every single file because the files in that directory can come and go. For example, if I have /home/me/bin/x and /home/me/bin/y, I could do this:

complete -F _longopt /home/me/bin/x
complete -F _longopt /home/me/bin/y

But there are two problems: 1) I won't get the autocompletion for free with /home/me/bin/z even though z has useful --help output just like x and y. 2) I won't get the autocompletion if I specify "~/bin/x" instead of "/home/me/bin/x"

标签: autocomplete
© 2014 TuiCode, Inc.