以下脚本使用
-e
选项运行,如果其中任何命令失败,它将退出:#!/bin/sh -e
command1 #script should fail if command1 fails
command2 #script should NOT fail if command2 fails
command3 #script should fail if command3 fails
如何使脚本在执行command2
时不失败?
command2
的确切退出状态采取不同的操作)。 - chepner