第一个shell 脚本

步骤1:创建一个txt 文件

touch 1.txt

步骤2:使用vi 编辑文件

#!/bin/sh
a="hello shell"
echo "A is"
echo $a

步骤3:给文件添加执行权限

chmod +x 1.txt

步骤4:执行文件

./1.txt

输出结果:

# ./1.txt
A is
hello shell

原文地址:https://www.cnblogs.com/simone-wenwen/p/4757287.html