I'm trying to make my go program to execute a script file (.sh) that in my Linux (ubuntu) system and every time I'm getting the following error:
Got command status: fork/exec /home/myname/Code/MyProj/Server/src/: permission denied
the script that I'm trying to run is pretty simple:
temp.sh:
echo tempscript:$1
temp.sh permissions:
-rwxrwxrwx 1 myname myname 19 oct 13 13:33 temp.sh
the golang code I'm using to run the script :
output, err := exec.Command("/home/myname/MyProj/Server/src/", "temp.sh").CombinedOutput()
if err != nil {
fmt.Println("Error when running command. Output:")
fmt.Println(string(output))
fmt.Printf("Got command status: %s
", err.Error())
}
fmt.Println(string(output))
I have no problem to run this script from the terminal, but when I'm trying to run it from my go problem I'm getting the permission problem, even when I tried to do go build and run my program with sudo permission I'm still getting that error. Happy to hear what am I doing wrong and how to solve it.
Thanks a lot