How do I get the effect and usefulness of “set -e” inside a shell function?

后端 未结 10 1890
北荒
北荒 2020-11-28 06:18

set -e (or a script starting with #!/bin/sh -e) is extremely useful to automatically bomb out if there is a problem. It saves me having to error ch

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 06:45

    I know this isn't what you asked, but you may or may not be aware that the behavior you seek is built into "make". Any part of a "make" process that fails aborts the run. It's a wholly different way of "programming", though, than shell scripting.

提交回复
热议问题