![08e750264cfcb42736b0c7b935be881a.png](https://img-blog.csdnimg.cn/img_convert/08e750264cfcb42736b0c7b935be881a.png)
由于工作需要,最近重新开始拾掇shell脚本。虽然绝大部分命令自己平时也经常使用,但是在写成脚本的时候总觉得写的很难看。而且当我在看其他人写的脚本的时候,总觉得难以阅读。毕竟shell脚本这个东西不算是正经的编程语言,他更像是一个工具,用来杂糅不同的程序供我们调用。因此很多人在写的时候也是想到哪里写到哪里,基本上都像是一段超长的main函数,不忍直视。同时,由于历史原因,shell有很多不同的版本,而且也有很多有相同功能的命令需要我们进行取舍,以至于代码的规范很难统一。
考虑到上面的这些原因,我查阅了一些相关的文档,发现这些问题其实很多人都考虑过,而且也形成了一些不错的文章,但是还是有点零散。因此我就在这里把这些文章稍微整理了一下,作为以后我自己写脚本的技术规范。
![877c6eec4015dd12d33b30199d44b090.png](https://img-blog.csdnimg.cn/img_convert/877c6eec4015dd12d33b30199d44b090.png)
![59b5dc9e5b06bbf1e331822e4866e40e.png](https://img-blog.csdnimg.cn/img_convert/59b5dc9e5b06bbf1e331822e4866e40e.png)
![cc0d2da55d2bd7f80f4cd1534fd54e40.png](https://img-blog.csdnimg.cn/img_convert/cc0d2da55d2bd7f80f4cd1534fd54e40.png)
![92573628b012f0f93ff4d78438db13f2.png](https://img-blog.csdnimg.cn/img_convert/92573628b012f0f93ff4d78438db13f2.png)
![904886abd12f2d1b9cd668d484ffa40d.png](https://img-blog.csdnimg.cn/img_convert/904886abd12f2d1b9cd668d484ffa40d.png)
![5a62040f7012351d132cfe69733ad2d8.png](https://img-blog.csdnimg.cn/img_convert/5a62040f7012351d132cfe69733ad2d8.png)
![e9121457b2507ceb682679ba74c2df65.png](https://img-blog.csdnimg.cn/img_convert/e9121457b2507ceb682679ba74c2df65.png)
![6042f80677a02b6e195d8a1449007cd1.png](https://img-blog.csdnimg.cn/img_convert/6042f80677a02b6e195d8a1449007cd1.png)
![f05b0e1a259e48b4e060fd51d00aa942.png](https://img-blog.csdnimg.cn/img_convert/f05b0e1a259e48b4e060fd51d00aa942.png)
![d4cfbefca7eb3984e6429913b5e27ef7.png](https://img-blog.csdnimg.cn/img_convert/d4cfbefca7eb3984e6429913b5e27ef7.png)
![faaa55ec4785e099038c8ee20873c22d.png](https://img-blog.csdnimg.cn/img_convert/faaa55ec4785e099038c8ee20873c22d.png)
![842b998020ee3205ca1b62a35bb512c2.png](https://img-blog.csdnimg.cn/img_convert/842b998020ee3205ca1b62a35bb512c2.png)
![da47df3bb9c9cb599b6c5b3552040bd2.png](https://img-blog.csdnimg.cn/img_convert/da47df3bb9c9cb599b6c5b3552040bd2.png)
![1a180e0080700e7d77b020965d7102f9.png](https://img-blog.csdnimg.cn/img_convert/1a180e0080700e7d77b020965d7102f9.png)
![7bc1e5d308bf7dc4792115962e3dfaa9.png](https://img-blog.csdnimg.cn/img_convert/7bc1e5d308bf7dc4792115962e3dfaa9.png)
![7323d832bf8827381679b8a443f44780.png](https://img-blog.csdnimg.cn/img_convert/7323d832bf8827381679b8a443f44780.png)
![228b63a17f14d525ccc0b39b8705b1b2.png](https://img-blog.csdnimg.cn/img_convert/228b63a17f14d525ccc0b39b8705b1b2.png)
【年薪30w工程师吐血整理资料大合集】
领取IT资料大合集:http://image.qbangmang.com/counselor.html
![5d2fc996221947b1109d3ca71fd39ce9.png](https://img-blog.csdnimg.cn/img_convert/5d2fc996221947b1109d3ca71fd39ce9.png)