extending Bash tab completion: how to handle paths / partial commands?

Posted by Rawing on Stack Overflow See other posts from Stack Overflow or by Rawing
Published on 2012-10-23T10:30:00Z Indexed on 2012/10/23 11:00 UTC
Read the original article Hit count: 112

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about bash

Related posts about autocomplete