How to enable tab-completion of command line switches in bash?

前端 未结 5 593
庸人自扰
庸人自扰 2021-02-04 08:39

With bash, I can complete a command with TAB. Normally, it should also complete the command line switches: e.g. when I typed:

java -
相关标签:
5条回答
  • 2021-02-04 09:06

    Related: Surprise! the shell suggests command line switches

    In the answers to that question there were several links to documentation. You might find what you look for there.

    0 讨论(0)
  • 2021-02-04 09:10

    If you want to create your own custom completions you can look at this post: https://stackoverflow.com/a/21476506/2649637

    0 讨论(0)
  • 2021-02-04 09:23

    Depending on what Linux flavor you're using, you may want to add a package. For Fedora and related distributions, you need to add the separate package bash-completion to get this to work. I wouldn't be surprised if other distributions had this packaged as an optional 2nd package that you need to add in addition to the bash package.

    0 讨论(0)
  • 2021-02-04 09:24

    Take a look at Extended Bash Completion

    0 讨论(0)
  • 2021-02-04 09:30

    You need to have bash_completion installed and then just add . /etc/bash_completion to your .bashrc.

    0 讨论(0)
提交回复
热议问题