I'm writing a script wrapping a certain Linux command. Now, that command, when I use it directly on the command-line, has some autocomplete behavior. For example, if I type the command name, then space, then a string and press Tab - it gets completed into the name of an executable on the path. However, the wrapper script does not seem to have this behavior. How can I get bash to use the same auto-completion for my wrapper as for the original command?
To make things more concrete: The command is which
. I'm writing a wrapper which invokes it, and if it didn't fail, executes readlink -f
on the result of which
. I would like auto-complete to find the executable on the path, as it does for which
.