software Show more
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
As far as I can tell, it works!
echo '..' | sed ..... => /home
echo 'foo/../foo' | sed ... => /home/esk/foo
But also why does this exist
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!
https://github.com/clvv/fasd/commit/27cfe91379edd903e97335b7243937c829b091d9#diff-389c29701786d2b38010bc3cf2489bc9R182
wobscale.social - a server for friends of the Wob, affiliated with Wobscale Technologies
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!
https://github.com/clvv/fasd/commit/27cfe91379edd903e97335b7243937c829b091d9#diff-389c29701786d2b38010bc3cf2489bc9R182