touch hello.sh
gedit hello.sh
然后输入
#!/bin/bash
echo "Hello world!"
chmod +x hello.sh
./hello.sh
本文介绍了一个简单的Shell脚本创建过程,通过示例代码展示了如何使用bash编写并运行一个打印'Helloworld!'的脚本。该脚本首先通过特殊符号指定解释器路径,接着使用echo命令输出文本,并通过chmod命令赋予文件执行权限。
touch hello.sh
gedit hello.sh
然后输入
#!/bin/bash
echo "Hello world!"
chmod +x hello.sh
./hello.sh
2203

被折叠的 条评论
为什么被折叠?