Safe recursive delete in bash : <p>Is there a way to check if the supplied path either by user input or some self-detect-mechanism safe to be deleted in bash scripting?</p>

<p>For example:</p>

<pre><code>rm -rf $SOMELOCATION
</code></pre>

<p>Obviously I don't want SOMELOCATION to be any of / /var /etc /home /usr /opt /root or some important directories.</p>

<p>Is there a way to prevent such <strong>incident</strong> in bash without iterating all those directory above (and possibly more important directory)?</p>

<p>Is there something like isSystemDirectory function return true or false? :-)</p>
