Today I Learned: 29/11/2022 - Setting bash to add a trailing slash when autocompleting symlinked directory names
Publish date: 29 Nov 2022
Every few years, I need to remind myself how to prevent a bash default behaviour I find very irritating - when autocompleting a directory that is a symlink (ie by pushing TAB) the directory doesn’t get a trailing slash. I then need to add the trailing slash myself before continuing to autocomplete directory names.
To fix this, this value can be set in your systems ~/.inputrc file:
set mark-symlinked-directories on
If you don’t have a ~/.inputrc file (I don’t) this can be set directly in your ~/.bashrc file:
bind 'set mark-symlinked-directories on'
I probably find a different reference every time I look this up - the most recent one I used was here.