How to run a 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:32 UTC
        
        
        Read the original article
        Hit count: 332
        
I've got a 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