[LINUX] Add "/" at the end when completing a directory symbolic link

Problem without slash

Symbolic creation

$ ln -s /path/to/target/dir_name ~/dir_name 

If you don't press Tab twice, you won't get a slash.

$ cd dir_na
[Tab]
$ cd dir_name 
[Tab]
$ cd dir_name/

Solution

Describe set mark-symlinked-directories on in .inputrc in your home directory. I made it because I didn't have the file itself.

$ echo "set mark-symlinked-directories on" >> ~/.inputrc

Some harmful effects

If / is added when rming a symbol, it will try to erase the actual situation. Be careful not to accidentally erase the entity.

#I'm going to do this
$ rm dir_name

#Possibility of making a mistake
$ rm dir_name/
rm: cannot remove 'dir_name/': Is a directory

References

[Don't call yourself a programmer without reading ls! ](Https://books.google.co.jp/books?id=kuKoDwAAQBAJ&lpg=PT76&dq=%E3%82%B7%E3%83%B3%E3%83%9C%E3%83%AA%E3%83 % 83% E3% 82% AF% E3% 83% AA% E3% 83% B3% E3% 82% AF% 20% E8% A3% 9C% E5% AE% 8C & hl = ja & pg = PT76 # v = onepage & q & f = false )

Recommended Posts

Add "/" at the end when completing a directory symbolic link
What is the difference between a symbolic link and a hard link?
[Ln] How to paste a symbolic link in a directory is complicated
How to put a symbolic link
[Machine learning pictorial book] A memo when performing the Python exercise at the end of the book while checking the data
It was dangerous to specify a relative path when generating a symbolic link
When you make a mistake in the directory where you execute `pipenv install`
Python Basic Course (at the end of 15)
Get the filename of a directory (glob)
Add a layer using the Keras backend
I get a strange window when I use the open directory dialog in Tkinter
[Linux] Let's talk about when I stumbled upon a symbolic link I was using.