当前位置:网站首页>Shell脚本简单语法

Shell脚本简单语法

2022-06-21 20:18:00 name_qgy

touch helloworld.sh
#!/bin/bash   
#This line is a comment
echo "Hello World"

#!执行该程序要用到bash解释器,位置
#注释

sh helloworld.sh
chmod +x helloworld.sh

添加权限,成为可执行程序

./helloworld.sh

注:./与后面的.sh文件中间没有空格

mv helloworld.sh /bin/
helloworld.sh

添加到$PATH变量所包含的路径中,使该脚本成为默认的系统命令

原网站

版权声明
本文为[name_qgy]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_50637636/article/details/119652391