Convert absolute to relative symbolic link
04:46 31 Oct 2018

I rsync the directory "Promotion" containing absolute symbolic links between two machines with different directory structures. Therefore absolute symbolic links don't work on both machines. To make them work, I would like to convert them to relative links. The directory structure is

Machine 1: /home/user/Privat/Uni Kram/Promotion/
Machine 2: /homes/user/Promotion/

Here are two example symlinks:

 4821      1 lrwxrwxrwx   1 manu  users         105 Nov 17  2014 ./Planung\ nach\ Priorit\303\244ten.ods -> /home/manu/Dokumente/Privat/Uni\ Kram/Promotion/Pl\303\244ne\ und\ Ideen/Pl\303\244ne/Planung\ nach\ Priorit\303\244ten.ods  
37675      1 lrwxrwxrwx   1 manu  users         102 Aug  3  2015 ./Kurs/Lab\ Course\ Somewhere -> /home/manu/Dokumente/Privat/Uni\ Kram/Promotion/Workshops\ &\ Fortbildungen/Kurs\ Lab\ Course\ Somewhere

My non-working try is (based on example this):

find * -type l -print | while read l; do 
ln -srf $(cut -c 24- < $(readlink $l)) $l;
done
bash sh symlink