If I have the following files in a directory:
$ ls
a-file-1
b-file-2
something-else
And I type
$ cat *file*<TAB>
The line unexpectedly updates to
$ cat a-file-1 |
(pipe denotes cursor) even though the glob also matches b-file-2
. A bit stranger is if I start another shell, I instead get a match listing on double-TAB (which I prefer):
$ cat *file*<TAB><TAB>
a-file-1 b-file-2
$ cat *file*|
Q: How is this behavior configured? I'd like to have the second behavior in the login shell.
It seems login shells are getting the first behavior, non-login shells are getting the second. However, my ~/.bash_profile
does little more than kick off ~/.bashrc
. (I don't have a .profile
.) It seems somewhere somehow I must be changing the configuration.
The shopt
differences are that only the login shell has extglob on
, hostcomplete off
, and login_shell on
but changing these doesn't alter the above behavior. set -o
output is the same. Tried set show-all-if-ambiguous on
but that had no effect. I'm using Ubuntu 14.04.1.
Update regarding comment by @mpy.
In a non-login shell, when I include a base directory in the glob and press Alt-G, the behavior is different than when I use TABTAB. It's this specific latter behavior I want to configure in the login shell.
Alt-G:
$ ls dir/*file*<Alt-G>
updates to
$ ls dir/|
removing the glob and not printing any matches. Whereas TABTAB outputs the matches
$ ls dir/*file*<TAB><TAB>
a-file-1 b-file-2
$ ls dir/*file*|
bind -P
). I can reproduce the behaviour of your login shell. But usingAlt-G
(glob-complete-word
) instead ofTAB
(complete
) I get the second behaviour.bind -P
output from both shells are identical. Also, the behavior ofglob-complete-word
is a little different than what I'm seeing in the non-login shell with TAB-TAB. I've updated my answer to explain.