What I'm looking for is not how to add autcompletion in bash for another program, but a way to get the result of what would have happened in bash to a string, basically:
autocomplete "/etc/apa"
would return
/etc/apache2/
so I can use that in my script.
Any help is greatly appreciated, for all I can find is how to use the "complete" bash function, which does something different ;)
Cheers, rafael