title: Symlink (ln) folders doesn't work as expected
body: <p>I am creating a script that basically look for all the things that ends with <code>.symlink</code> and try to create a symlink to the <code>$HOME</code> directory removing the <code>symlink</code> part and adding <code>dot</code> in front of the name. </p>
  
  <p>Below is the line showing how the destination is created.</p>
  
  <pre><code>dst="$HOME/.$(basename "${src%.*}")"
  </code></pre>
  
  <p>There are the two functions created for that</p>
  
  <pre><code>create_symlink () {
    local src=$1 dst=$2
  
    # Create the symlink
    ln -s -i "$src" "$dst"
    message "Linked $1 -------&gt; $2" # This just use echo
  }
  
  run_symlinks() {
    message "Creating Symlinks"
  
    local root=$1
  
    # Find the files/folder and try to do the symlink
    for src in $(find -H $root -name '*.symlink')
    do
      dst="$HOME/.$(basename "${src%.*}")"
  
      create_symlink "$src" "$dst"
    done
  }
  </code></pre>
  
  <p><strong>The problem</strong></p>
  
  <p>I have a <strong>folder</strong> called <code>atom.symlink</code> that folder basically have some configuration for my environment with the files of Atom text editor inside. When I run <code>run_symlinks</code> function that folder <strong>is being synced but in the wrong place.</strong></p>
  
  <p>The output of <code>message "Linked $1 -------&gt; $2"</code> is:</p>
  
  <pre><code>Linked $HOME/.dotfiles/src/symlinks/atom.symlink -------&gt; $HOME/.atom
  </code></pre>
  
  <p>But when I look at the folder the symlink is actually to <code>$HOME/.atom/atom.symlink</code> instead of just to the <code>.atom</code> folder.</p>
  
  <p><strong>Note:</strong> the <code>$HOME/.atom</code> folder is not empty and I need to figure out how to make this script without worry about having an empty folder.</p>
  
  <p>I tried to find the answer on Google but I could't even know how to ask this specific question about it.</p>