title: Shell script to check for string and special characters
body: <p>I'm writing a sample shell script, I have to perform some operation if the string is not equal to "sample" and string doesn't contain special characters. I tried below code, but I'm getting syntax errors. Is this proper way of doing it? If not, what's the correct way of doing it?</p>
  
  <pre><code>#!/bin/bash
    str='sudo'
    if [ "$str" != "sample" ] &amp;&amp; [[ "$str" != *['!'@#\$%^\&amp;*()_+]* ]]
    then
        echo "Proceed"
    else
         echo "Stop"
    fi
  </code></pre>
  
  <p>I'm getting syntax errors like this :</p>
  
  <pre><code>bash-3.2$ ./test.sh
  ./test.sh: line 3: syntax error in conditional expression: unexpected token `('
  ./test.sh: line 3: syntax error near `&amp;*()'
  ./test.sh: line 3: `if [ "$str" != "sample" ] || [[ "$str" != *['!'@#\$%^\&amp;*()_+]* ]]'
  </code></pre>