2

I have been trying to get 'match-hidden-files' to work on bash 4.3.11, but I can't. I wanted to make sure it's not something I'm doing wrong.

$ grep match-hidden-files .inputrc 
set match-hidden-files on

Here are example folders:

$ ls -ld .icon*
lrwxrwxrwx 1 victor victor   57 Oct 20 10:39 .icons -> /home/victor/Sync/BitTorrentSync/victor/ConfigFiles/icons
drwxrwxr-x 2 victor victor 4096 Nov  2 00:14 .icons2
-rw-rw-r-- 1 victor victor    0 Nov  2 00:55 .icons3
drwxrwxr-x 2 victor victor 4096 Nov  2 00:59 .icons4

When I type 'cd ico' (without the '.') and press Tab nothing happens. I would expect to see this:

$ ls .ico
.icons/  .icons2/ .icons3  .icons4

1 Answer 1

2

You should not expect to see cd icoTab to match anything starting with . as you already gave the beginning of the filename yourself.

The man page is not very explicit:

match-hidden-files (On)
       This variable, when set to On, causes readline to  match  files
       whose  names  begin  with  a `.' (hidden files) when performing
       filename completion.  If set to Off, the leading  `.'  must  be
       supplied by the user in the filename to be completed.

If you do lsTab and you have set match-hidden-files on (the default) it will change to ls .icons on the first Tab and to:

$ ls .icons
.icons/  .icons2/ .icons3  .icons4/

on the second Tab, and if you have set it to off it will not.

Once you start with ls ico it will not retroactively put the dot before the i, whatever the value of match-hidden-files.

Please note that you need to start a new bash to check any changes to ~/.inputrc, it is not re-read for new commands. As indicated match-hidden-files default is on, so you do not need to set it explicitly.

1
  • 1
    Got it... thanks for the explanation. I had read the man page and that second part is very misleading: "If set to Off, the leading `.' must be supplied by the user in the filename to be completed." But I did a few tests and saw what you explained. Thanks.
    – victorbrca
    Nov 3, 2014 at 5:46

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.