Today I Learnt: Symlinks are Relative
If the current working directory is /Users/admin
I thought the two commands should work the same.
ln -s borg-env/bin/borg /usr/local/bin/borg
ln -s /Users/admin/borg-env/bin/borg /usr/local/bin/borg
However the first one gives me “-bash: borg: command not found” when I run borg
.
It only hit me when I looked closer at the output of ls -la /usr/local/bin/
lrwxr-xr-x 1 admin admin 33 28 Feb 20:56 bashbug -> ../Cellar/bash/4.3.42/bin/bashbug
lrwxr-xr-x 1 admin admin 17 19 Apr 18:14 borg -> borg-env/bin/borg
Where I saw ../
, turns out symlinks are relative, who knew? My first command was trying to run /usr/local/borg-env/bin/borg which didn’t exist.
Learnt and Learned are both acceptable under Aussie English.