Login
From:
Posts on Fu, Wei
(Uncensored)
subscribe
让你的 shell 脚本变得可控
https://fuweid.com/post/2017-control-your-shell-script/
links
backlinks
Roast topics
Find topics
Find it!
刚开始接触 shell 脚本的时候,最痛苦的地方在于出了问题,却不容易定位问题。 shell 脚本遇到错误,“大部分” 情况下都会继续执行剩下的命令,最后返回 Zero Exit Code 并不代表着结果正确。 这让人很难发现问题,它不像其他脚本语言,遇到 语法错误 和 typo 等错误时便会立即退出。 如果想要写出容易维护、容易 debug 的 shell 脚本,我们就需要让 shell 脚本变得可控。 set -e ...