The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 04-24-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,632
Code:
set -e
This will make the script terminate on any unhandled error.

It's more picky than you think, so a script which was not written to cope with this probably has unchecked commands which might bite you in the back. (It's good for the self-discipline, of course.)

For example, anything like hello && echo success will terminate the script if hello fails. You need to rewrite that as an if ... then, or artificially add || true at the end.
Reply With Quote