compgen -d -- $cur
will suggest completions for the directories in pwd only right?
Can I get it to suggest directory completions for some dir while being in another dir.
For eg. if I am in /curr_dir
, and I want to generate directory completions for /other_dir
what do I do? How do I specify it to compgen
, so that I don't need to go to /other_dir
In my bash-completion function, I tried doing a cd
to that dir before calling compgen
but that leaves me in the other dir after pressing <Tab>
.