I have a simple script use to install a package under cust privilege like this (command changed for security) installScript.sh
#!/bin/bash
patch -i <package-name> << EOF
n
EOF
the purpose of this script is for automate enter N (No) when prompt "Are you sure? (Y/n)" for testing purpose. The permission of this file is
-rwxrwxrwx. 1 cust root 66 Jul 25 15:06 installScript.sh
However, When I execute this command using
./installScript.sh
or
sh /home/cust/installScript.sh
I get the permission denied. But by executing patch
command manually, I can get things working out normally without any issues. Is there anything that need to be configured?
#!/bin/bash
it is wrong to usesh
to execute it. Usebash
or better still just run it directly