2
下面的脚本与-e
选项运行,所以如果在它的命令失败,那么将退出:如何避免shell脚本失败退出的特定命令
#!/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
上失败?
这是尴尬。 – Sigi
在某些情况下可能有必要(可能需要根据'command2'的确切退出状态采取不同的操作)。 – chepner