Ok, so it's basically what I usually set in my .inputrc
to get zsh
like behavior in bash
:
set show-all-if-unmodified on
set show-all-if-ambiguous on
Place the above lines in ~.inputrc
and you're good to go. When doing something like ls *.txt
just tab and it should glob everything for you and output the matching files.
EDIT: quotes from man bash
:
show-all-if-ambiguous (Off)
This alters the default behavior of the completion functions. If set to On, words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell.
show-all-if-unmodified (Off)
This alters the default behavior of the completion functions in a fashion similar to show-all-if-ambiguous. If set to On, words which have more than one possible completion without any possible partial completion (the possible completions don't share a common prefix) cause the matches to be listed immediately instead of ringing the bell.
EDIT2: example output
$ ls *
books dev music templates
$ ls *
Though it won't work if the one would try to expand the following (as it would try to complete the later argument ~/some/other/folder
:
$ cd * ~/some/other/folder
echo file*.txt
? – Joe P Jun 05 '17 at 14:55cp file*.txt dir1/
expanded tocp file1.txt file2.txt file3.txt file4.txt dir1
– sshekhar1980 Jun 05 '17 at 14:57zsh
and it worked with tab completion. I will use that if I cannot figure out how to print the expanded content inbash
– sshekhar1980 Jun 05 '17 at 15:01set -x
in the interactive shell too... – steeldriver Jun 05 '17 at 15:06bash
– ddnomad Jun 05 '17 at 15:09