When I use tab completion on an argument after ls command it works, but when I use it after some script argument (see second example below) it does not work. I have checked that tab completion is enabled. How to make tab completion run for all commands?

Note: I'm running this in a screen session (on Ubuntu) if that matters.

user$ echo $SHELL
user$ grep completion ~/.bashrc
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
user$ ls test[TAB]

user$ ./script.sh >& test[TAB]  <-- "no output"

Bash version: GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)


Try the equivalent:

$ ./script.sh &> test[TAB]

The &> is the preferred syntax for redirecting both stdout and stderr to a file.

Tab-completion sees that (>&) as some other syntax and doesn't show the files.

  • Thanks, how did you figure this out?
    – user13107
    Mar 27 '17 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.