title: C Shell - How to check if argument starts with '-' character?
body: <p>I am new to csh and trying to check if argument starts with '-'. I've tried following:</p>
  
  <pre><code>if (`echo $var | awk '{print substr($var,0,1)}'` == '-') then
  </code></pre>
  
  <p>When running  script with argument 's', I get </p>
  
  <pre><code>if: Expression syntax
  </code></pre>
  
  <p>When running script with argument '-s', I get</p>
  
  <pre><code>if: Missing file name
  </code></pre>
  
  <p>I also tried</p>
  
  <pre><code>if ($var =~ -*) then
  </code></pre>
  
  <p>When running a script with argument '-s', I get</p>
  
  <pre><code>if: Missing file name
  </code></pre>
  
  <p>'s' argument stays silent and does not get inside of if</p>