title: How to create symlink to another symlink without following symlink while keeping relative path?
body: <p>How to create a symlink to another symlink without following target symlink but keeping relative path between the target symlink and created symlink ?</p>
  <p>Using the following structure for test</p>
  <pre><code>├── dst
  │   
  └── src
      ├── file.txt -&gt; folder/file.txt
      └── folder
          └── file.txt
  
  
  lrwxrwxrwx 1 user group 15 mars  16 20:05 src/file.txt -&gt; folder/file.txt
  </code></pre>
  <p>Each time I try to create a symlink of <code>src/file.txt</code> (itself a relative symlink of <code>src/folder/file.txt</code>) in <code>dst</code> folder, the resulting symlink is never like <code>dst/file.txt -&gt; ../src/file.txt</code> but always directly to the final target <code>dst/file.txt -&gt; ../src/folder/file.txt</code></p>
  <pre><code>ln -s -r [-T] 'src/file.txt' dst/file.txt
  </code></pre>
  <p>Only working without <code>-r</code> and specifying myself the relative path</p>
  <pre><code>ln -s '../src/file.txt' dst/file.txt
  </code></pre>
  <p>I need to use this inside a for loop for many files recursively and I would like to keep a relative path between the symlinks but without following target symlink, just a relative symlink to another symlink.</p>
  <p>Is it possible to use <code>ln</code> with <code>-r</code> relative option without following target symlink ?</p>
  <p>Regards</p>