3

I have the following Bash alias which doesn't take any arguments.

alias b='cd ..'

Typing b<space> and then pressing <tab> brings up completion results for any paths in the current directory. How can I make it so that pressing <tab> does not trigger autocompletion of any kind? I have already tried complete -r b which didn't help.

1
  • 1
    Hi and welcome to Unix Stackexchange. Why do you need to type b<space><tab>? Also, can you clarify if you want to disable autocompletion entirely, or just for commands starting with the letter 'b'? Commented Jan 31, 2019 at 1:06

1 Answer 1

1
-bash-4.2$ alias b='cd ..'
-bash-4.2$ function nope() { :; }
-bash-4.2$ complete b -F nope
-bash-4.2$ b 

So completing on the nope function appears to disable completion. Can we improve on this?

-bash-4.2$ alias b='cd ..'
-bash-4.2$ b
Display all 116 possibilities? (y or n)
-bash-4.2$ complete b -C :
-bash-4.2$ b 

appears so; the "nothing" : command avoids the need to add a do-nothing function.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.