Say I have two paths:
<target_path>. I would like my shell (zsh) to automatically find out if there is a way to represent
<source_path> as a relative path.
E.g. Let's assume
The result would be
Why I need this:
I need like to create a symbolic link from
<target_path> using a relative symbolic link whenever possible, since otherwise our samba server does not show the file properly when I access these files on the network from Windows (I am not the sys admin, and don't have control over this setting)
<source_path> are absolute paths, the following creates a symbolic link pointing to an absolute path.
ln -s <target_path> <source_path>
so it does not work for my needs. I need to do this for hundreds of files, so I can't just manually fix it.
Any shell built-ins that take care of this?