次のように端末画面にすべての可能性を表示する代わりに:
$ ls /etc/<TAB>
Display all 230 possibilities? (y or n)
すべての可能性をファイルに保存したいと思います。
ls /etc/ > file.txt
常に動作するわけではありません。 apt-getは例です。
$ apt-get <TAB>
autoclean check install update
autoremove clean purge upgrade
build-dep dist-upgrade remove
changelog dselect-upgrade source
tabcompletions 'ls /etc/'
2つのコマンドのタブ補完の可能性を比較する次のコマンドを実行できるように、すべての可能性を出力するこのようなコマンドを探しています。
diff <(tabcompletions 'ls ') <(tabcompletions 'cd ')
それは可能ですか?
ベストアンサー1
あなたのものには~/.bashrc
おそらく次のようなものがあります。
if [ -f /etc/bash_completion ] && ! shopt -oq posix
then
source /etc/bash_completion
fi
検索が続く場所で、タイトルには_quote_readline_by_ref
必要なヒントが含まれています。
compgen -f /etc/
type compgen
これをもう一度追跡してみると、compgenが「シェル組み込み」であることがわかりました。つまり、次の位置に現れなければならないという意味ですman bash
。
compgen [option] [word]
Generate possible completion matches for word according to the options ...