简体   繁体   中英

Shell script Execute file in tmp directory

I am trying to execute shell script which i have created in tmp folder. i have granted permission as well to the script using command below.

chmod a+x tmp/test/test.sh

when i run the code i get permission denied error.

[root@server test]# ./test.sh
-bash: ./test.sh: Permission denied

Try this workaround:

(. tmp/test/test.sh)

The issue may cause by tmp is noexec, and you can use the sh command to execute the the shell script

sh./test.sh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM