bash-completion
bash-completion copied to clipboard
Autocompletion failing for an SSH config including globs matching directories
I am running OpenSSH 8.2 on Ubuntu 20.04. I would like to structure my .ssh/config file so that it includes directories with subdirectories:
Include config.d/*
Include config.d/dir1/*
Include config.d/dir2/*
Include config.d/dir3/*
If I have a host remotevm
and I try the autocompletion when I type ssh remotevm
, I get the following error:
$ ssh remosed: read error on /home/user/.ssh/config.d/dir1: Is a directory
sed: read error on /home/user/.ssh/config.d/dir2: Is a directory
sed: read error on /home/user/.ssh/config.d/dir3: Is a directory
awk: read error (Is a directory)
What can I do so that the autocompletion works again like before?
Best regards
$ echo "$BASH_VERSION"
5.0.17(1)-release
$ (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
2.10
Confirmed still happening with current master.
There's an easy workaround though; construct your globs so that they don't match any dirs. So for example name your confs *.conf
, and Include
them as .../*.conf
instead of .../*
(and be sure you don't have any dirs matching .../*.conf
there).
I'm actually somewhat surprised if your config works without problems with ssh itself.
Thank you for the tip!