How to check if file has a symlink
<p>I am writing a bash shell script (for RH and Solaris) that uses openssl to create hash symlinks to certificates all within the same directory. I have approx 130 certificates and when new certs are added I would like the script to create symlinks for the new certs only. I may have to resort to deleting all symlinks and recreating them but if there is a not-so-difficult way to do this; that is preferable than deleting all and recreating.</p>

<p>I know how to find all files with symlinks:</p>

<pre><code>find . -lname '*.cer'
</code></pre>

<p>or </p>

<pre><code>find . -type l -printf '%p -&gt; %l\n'
</code></pre>

<p>But I am not sure how to negate or find the inverse of this result in a for or other loop. I want to find all files in the current directory missing a symlink.</p>

<p>Thanks!</p>