Shell脚本开发规范

一、开头指定脚本解析器

#!/bin/sh 或 #!/bin/bash

二、开头加版本版权等信息

#Date: 2017-04-11
#Auth: Created by Lee
#Mail: xxx@163.com
#Function: This scripts function is ...
#Version: 1.1

三、不要使用中文注释

四、脚本以.sh为扩展名

五、代码的书写优秀习惯

1) 成对内容的一次书写完成,防止遗漏

{},[],``,'',""

2) []中括号中的内容两端要有空格

3) 流程控制语句一次书写完成

if 条件
    then
        内容
fi

for
    do
        内容
    done
写·
原文地址:https://www.cnblogs.com/moonlightL/p/7388176.html