title: How to check status of error code in csh?
body: <p>This is not a Perl questions, this is a csh question. </p>
  
  <p>Perl 5.8.8 on Linux RHEL 5.5.56. </p>
  
  <p>I have a test Perl program which uses 'exit 3;' to set the exit status. The Perl program is run from a csh script I call 'test'. </p>
  
  <p>Perl program: </p>
  
  <pre><code>#/usr/bin/perl
  # July 11, 2014
  # Test exit code with csh $status variable
  my($i);
  $i=3;
  print "$0 Exit with error code $i\n";
  exit $i;
  </code></pre>
  
  <p>'test' csh script that calls Perl progam:</p>
  
  <pre><code>#/bin/csh
  # July 10, 2014,
  
  perl tstatus.pl
  echo "Status=$status"
  if ($status &gt; 0) then
      echo "ERROR in status: $status"
  endif
  </code></pre>
  
  <p>The line 'echo "ERROR in status: $status" is never executed even though 'echo "Status=$status' says status is 3. </p>
  
  <p>How do I get my csh to check and act on the value of $status?
  $status is a system variable it seems. </p>
  
  <p>I have also tried 'if ($stats) then' but that doesn't work either. No errors are reported in the csh script. </p>
  
  <p>Thank you.</p>
  
  <p>p.s. I don't do complicated stuff in csh so I'm not ready to go to bash yet. I've read the "why not csh" file already. Thanks. </p>