美文网首页
Linux shell 脚本运行配置

Linux shell 脚本运行配置

作者: Rinaloving | 来源:发表于2023-02-22 15:40 被阅读0次

shell 脚本运行配置

1. 查看环境

  • echo $PATH


    QQ截图20230223120040.png

2. 编写脚本

  • touch test.sh 创建 test.sh 文件
  • vim test.sh 编辑test.sh 文件
#!/bin/bash
# testing the if statement
if pwd
then
        echo "It worked"
fi

3. 执行脚本

[root@VM-0-7-centos test]# ./test.sh
-bash: ./test.sh: Permission denied

4.授权

chmod u+x test.sh 

5. 再次执行

[root@VM-0-7-centos test]# ./test.sh 
/usr/local/test
It worked
[root@VM-0-7-centos test]# 

相关文章

网友评论

      本文标题:Linux shell 脚本运行配置

      本文链接:https://www.haomeiwen.com/subject/qorakdtx.html