Shell 脚本(shell script),是一种为 shell 编写的脚本程序。
通常所说的 shell 通常都是指 shell 脚本,但是shell 和 shell script 是两个不同的概念。
在一般情况下,不区分 Bourne Shell 和 Bourne Again Shell。
所以,像 #!/bin/sh,它同样也可以改为 #!/bin/bash。
#! 是指告诉系统其后路径所指定的程序即是解释此脚本文件的 Shell 程序。
shell之hello world
1.新建helloworld.sh<注:.sh后缀并不影响脚本的执行,决定是否是shell脚本的是#!/bin/bash>
2.编写代码
#!/bin/bash
echo "Hello World !"
3.给脚本添加权限
chmod +x ./test.sh #使脚本具有执行权限
不赋权限则使用sh 命令执行
4.执行
./helloworld.sh #执行脚本