Shell有很多种,但是这里我们使用云服务器上常用的是bash (Bourne Again Shell)
bash的写法非常简单,我们来输出第一个shell的hellow程序(这里将文件名命名为demo.sh):
#!/bin/bash
echo "Hello www.x9day.com"
然后执行它:
这里有两种执行方式
第一种是bash 文件名
如bash ./demo.sh
bash ./demo.sh
#执行结果
[root@DataBroker test]# bash ./demo.sh
Hello www.x9day.com
第二种是直接执行文件名,注意,在当前路径下执行要添加
./
如./demo.sh
如果输入有权限不够的报错,就是输入这段代码片chmod +x ./demo.sh
[root@DataBroker test]# ./demo.sh
Hello www.x9day.com