How do I execute a bash script from my Go program? Here's my code:
Dir Structure:
/hello/
public/
js/
hello.js
templates
hello.html
hello.go
hello.sh
hello.go
cmd, err := exec.Command("/bin/sh", "hello.sh")
if err != nil {
fmt.Println(err)
}
When I run hello.go and call the relevant route, I get this on my console:
exit status 127
output is
I'm expecting ["a", "b", "c"]
I am aware there is a similar question on SO: Executing a Bash Script from Golang, however, I'm not sure if I'm getting the path correct. Will appreciate help!