揮発性のメモ2

http://d.hatena.ne.jp/iww/

Cygwinで、コマンドラインでtabを押したときのファイル名補完で .exe が表示されない

Cygwinで hello.exe を実行するときに、 bash上で ./he まで入力してtabを押しても ./hello で止まってしまって ./hello.exe とならない。
コマンドの引数のときの補完では ちゃんと hello.exe まで出る。
別に ./hello で普通に実行できるからいいんだけど、気分は良くない。


調べたところ、 shopt に completion_strip_exe というexeを非表示にできるオプションがあるらしい。

$ man bash
。。。
      completion_strip_exe
              If set, whenever bash sees foo.exe during completion, it
              checks if foo is the same file and strips the suffix.

これがデフォルトで有効になっていたので、.bashrc で無効にして解決した。

shopt -u completion_strip_exe


どうも海外のサイトを見ていると、これは大いに受け入れられているらしい。
どこをみても「.exeつかなくなった!やったぜ」的な反応ばっかりでビビった