首页 > 解决方案 > 找不到函数时如何退出shell脚本?

问题描述

我正在使用 Ubuntu 14 /bin/bash。如果没有找到某个函数,shell 脚本不会失败。如果发生这种情况,如何让脚本退出?

作为参考,我的高级代码结构是:

funcA() {
   funcB() # this is accidentally called but is never define due to editing error
   funcC()
}

funcA

标签: linuxbash

解决方案


推荐阅读