1)开头指定脚本解释器web
#!/bin/sh ;#!/bin/bashshell
2)开头加版本及版权信息bash
3)脚本中不用中文注释spa
4)文件以.sh扩展名保存unix
5)成对的内容一次性写全,防止泄露调试
6)[ ]中括号两端要有空格code
7)流程控制语句一次性写完,再添加语句orm
shell调试脚本方法:it
1)shell调试之echo关键命令class
2)shell调试之bash参数
sh -n filename sh -x filename sh -v filename
舒适小提示:
你检查脚本明明没有问题,可是就是执行出现莫名其妙的错误,要想到执行dos2unix命令,每次执行脚本都dos2unix下