I've added tab completion for my program to bash. It works quite well, but I don't know how to handle partial completion of words. Example: the user types
./program /home/user/De
and presses TAB. This is then completed to
./program /home/user/Desktop/
, but there's now a trailing whitespace after 'Desktop/', which is not what I want. Basically, I need a way of preventing bash from adding whitespace after the completed word.
I don't want to use bash's completion for paths.
Edit: This seems to be unclear. When TAB is pressed, my tab-completion function finds out which word to complete (in this case, that's '/home/user/De'). It then generates a list of matches (in this case, the only match is '/home/user/Desktop'). Bash uses this list to do the actual completion: It changes '/home/user/De' to '/home/user/Desktop/ '. I want to prevent bash from adding that whitespace after 'Desktop/'.