This question is quite similar to this one, but I can't understand the solution. I also know this tutorial, but still I am unable to understand what I am doing wrong.
I am trying to autocomplete the list of directories that are placed in /something/:
$ ls /something/
One Other Three
in a way that this will happen:
$ hi [TAB]
One Other Three
$ hi O[TAB]
One Other
Only when the first word is hi and not only inside /something/.
This is what I am doing in .profile:
_codeComplete()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen `ls /something/` -- $cur) )
}
complete -F _codeComplete "hi "