software
the best and worst implementation of realpath I've seen:
sed '/^[^/]/s@^@'"$PWD"'/@
s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0
s@[^/][^/]*//*\.\./@/@;t 0
s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@;s@^$@/@'
from https://github.com/clvv/fasd/blob/90b531a5daaa545c74c7d98974b54cbdb92659fc/fasd#L320-L331
software
Original commit that added it doesn't totally answer why it exists, but I guess it's the best I'll get for now. It was a lot shorter back then too!
software
As far as I can tell, it works!
echo '..' | sed ..... => /home
echo 'foo/../foo' | sed ... => /home/esk/foo
But also why does this exist