title: Delete a directory only if it exists using a shell script
body: <p>I have a shell (<code>ksh</code>) script. I want to determine whether a certain directory is present in <code>/tmp</code>, and if it is present then I have to delete it. My script is:</p>
  
  <p><strong>test</strong></p>
  
  <pre><code>#!/usr/bin/ksh
  # what should I write here?
  if [[ -f /tmp/dir.lock ]]; then
      echo "Removing Lock"
      rm -rf /tmp/dir.lock
  fi
  </code></pre>
  
  <p>How can I proceed? I'm not getting the wanted result: the directory is not removed when I execute the script and I'm not getting <code>Removing Lock</code> output on my screen.</p>
  
  <p>I checked manually and the lock file is present in the location.
  The lock file is created with <code>set MUTEX_LOCK "/tmp/dir.lock"</code> by a TCL program.</p>