Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I tab tab _ in terminal, Bash suggests 206 posibilities. I tried to run one of them _git_rm but nothing happend, what are they?

Here is a screenshot:

enter image description here

share|improve this question
9  
type _git_rm will probably tell you that it is a function. grep -R '_git_rm' /etc/bash_completion.d/ will probably find it. Those functions are usually those which provide the various completion lists for bash completion. –  manatwork Mar 18 '13 at 17:42
    
thanks @manatwork –  draw Mar 18 '13 at 17:50
    
@manatwork please post that as an answer. –  derobert Mar 18 '13 at 19:37
    
@derobert, I only intended to provide a quick hint so the question owner gets something before the expert answer posted ~7 hours later. –  manatwork Mar 19 '13 at 8:19
    
@manatwork The answer is enough for me... I can explore more by myself :D If you don't mind, I'll accept Gilles's anwser though I think I should accept yours.. –  draw Mar 19 '13 at 16:18

1 Answer 1

up vote 1 down vote accepted

These functions whose name begins with an underscore are part of the programmable completion engine. Bash follows zsh's convention here, where the function that generates completions for somecommand is called _somecommand, and if that function requires auxiliary functions, they are called _somecommand_stuff.

These completion functions typically do nothing useful or raise an error if you call them manually: they're intended to be called from the completion engine.

This follows on a fairly widespread practice in various programming languages to use a leading underscore to indicate that a function or variable is in some way internal to a library and not intended for the end-user (or end-programmer).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.