1. 开头(首行)需要加 : #!/bin/bash
2. 以#开头的行作为解释说明 :
3. 脚本的名字以.sh结尾,用于区分这是一个shell脚本
4. 执行.sh脚本方法有两种 :
1) 先给.sh脚本添加x权限:[root@hao-01 ~]# chmod +x 1.sh
.sh脚本的绝对路径回车:[root@hao-01 ~]# /root/1.sh
2) bash(bash=sh)执行.sh脚本 :[root@hao-01 ~]# bash 1.sh
5. 查看脚本执行过程 :[root@hao-01 ~]# sh -x 1.sh
6. 检测脚本是否有语法错误 ?[root@hao-01 ~]# sh -n 1.sh