Linux shell 脚本运行配置

2023-02-22  本文已影响0人  Rinaloving

shell 脚本运行配置

1. 查看环境

2. 编写脚本

#!/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]# 
上一篇 下一篇

猜你喜欢

热点阅读