title: Finding all symlinks in a directory and echoing their paths and owners of the original file
body: <p>I'm trying to make a script that will find all symlinks in a directory that the script is currently in, and it will echo <em>&quot;This 'link' refers to 'path' and it's owner is 'owner'.</em></p>
  <p>I've come up with this solution so far, but it doesn't work for some reason.</p>
  <p>Here's my code:</p>
  <pre><code>#!/bin/bash
  
  for each in .
  do
    echo &quot;Link '$1' refers to&quot; $(realpath $1) &quot;and its owner is: &quot; $(ls -ld $(realpath $1) | awk '{print $3}')
  end for
  </code></pre>
  <p>And this it the error that it gives me:</p>
  <pre><code>jakub.kacerek@perun:~$ ./najdi_symlink.sh
  ./najdi_symlink.sh: line 7: syntax error: unexpected end of file
  jakub.kacerek@perun:~$
  </code></pre>
  <p>I'm 100% sure that the error is in the for loop, but I don't know how to solve it.</p>