脚本停止,尽管随后读取了“ set -e”

时间:2018-09-06 13:59:49

标签: bash githooks

我有一个用于git post-receive hook的脚本

read oldrev newrev refname
set -e

echo DELETE
rm -rf *
echo DELETED
...

运行脚本时,输出看起来像这样

remote: DELETE

但是脚本停止了。但是,当我删除“ set -e”或删除“ read”时,它将起作用。

read oldrev newrev refname

echo DELETE
rm -rf *
echo DELETED
...

结果

remote: DELETE
remote: DELETED

set -e

echo DELETE
rm -rf *
echo DELETED

结果

remote: DELETE
remote: DELETED

我不明白为什么它不起作用。

编辑:添加第二和第三个代码示例的输出

0 个答案:

没有答案