1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| shell是用户与Linux操作系统沟通的桥梁。
shell脚本文件名后缀通常是 .sh
shell脚本第一行内容是: #!/bin/bash
注意:其他以#开头的表示是注释
执行脚本 hello.sh
bash hello.sh # 不需要执行权限也可执行 sh hello.sh # 表示把hello.sh 当作参数传入bash ./hello.sh # 需要有执行权限 chmod 755 hello.sh hello.sh # 需要添加.到系统变量 vim /etc/profile export PATH=.:$PATH # 最后一行添加内容 source /etc/profile # 重新加载
|