How to run a tcsh shell command and selectively ignore the status?

Posted by Walter Nissen on Stack Overflow See other posts from Stack Overflow or by Walter Nissen
Published on 2010-06-14T23:13:37Z Indexed on 2010/06/14 23:42 UTC
Read the original article Hit count: 305

Filed under:
|
|
|

I've got a tcsh shell script that I would like to stop with an error on nonzero status most of the time, but in some cases I want to ignore it. For example:

#!/bin/tcsh -vxef

cp file/that/might/not/exist . #Want to ignore this status
cp file/that/might/not/exist . ; echo "this doesn't work"
cp file/that/must/exist . #Want to stop if this status is nonzero

© Stack Overflow or respective owner

Related posts about unix

Related posts about shell