When linking a directory to root, I get this error:
$ ln -s ~/inbox/ /
$ ln: //: Is a directory
Bash autocompletes the directory path by adding a /. I've tried escaping without success.
$ ln -s ~/inbox /
works though. Why is this?
When linking a directory to root, I get this error:
$ ln -s ~/inbox/ /
$ ln: //: Is a directory
Bash autocompletes the directory path by adding a /. I've tried escaping without success.
$ ln -s ~/inbox /
works though. Why is this?
In pathname resolution, having a trailing / is equivalent to a trailing /. — in other words, ~/inbox/ is equivalent to ~/inbox/. in this context. So the ln command is trying to create a link called . in the root directory (and, unsurprisingly, failing).
Zsh removes the trailing / when you press Space after completing a directory (unless configured not to do so). I don't know if bash can be made to do this.
Is that exactly what you ran?
Is a directory looks like your OS printing the EISDIR error, which could happen two ways:
Trying to overwrite an existing symlink that points to a directory.
$ cd $(mktemp -d)
$ mkdir dir
$ ln -s dir dir # this creates dir/dir
$ ln -s dir dir # this fails, because dir/dir already exists
ln: failed to create symbolic link `dir/dir': File exists
Trying to create a hard link to a directory.
$ cd $(mktemp -d)
$ mkdir dir
$ ln dir dirlink
ln: `dir': hard link not allowed for directory
If it is what you were running, what does type ln or alias ln print?