Tab path completion does not work (at least on Ubuntu and AFAIK Arch) with
sudo mount <whatever>
The iso file I am trying to mount is not in /etc/fstab
. If I just type
mount <whatever>
the completion works (but of course the command fails as I am not root). Apparently it is sudo
that breaks it.
How can make completion work with sudo?
It is surprising that with
sudo umount <whatever>
completion works. How is it achieved? Does it look into /etc/fstab
?
Solution: I just put a shell script into /usr/local/bin
that calls sudo mount ...
with the arguments passed to it. Completion works when calling this script since there is no sudo
in the way.
Best Answer
This has not at all to do with
bash
, but it depends on the completions programmed in the packagebash-completion
.From some comments in the file
/etc/bash_completion.d/mount
:Also, you find in the main file
/etc/bash_completion
the following comment, that explicitly talk aboutmount
andumount
commands:Update:
The comment about
mount
andumount
commands was removed frombash_completion
in the commit:Released in
bash-completion 1.90