I am trying to run a bash script that has parameters like so:
./test.sh param1 param2
bash file
param1=$1
param2=$2
echo $param1
echo $param2
However it does not work but it will work if the params are not there.
cmd, _ := exec.Command("/bin/sh", fmt.Sprintf("./test.sh %s %s","test1","test2")).Output()
But if I change the bash script to do something else without passing anything into it, then it works.
cmd, _ := exec.Command("/bin/sh", "./test.sh").Output()
How can I pass parameters into a bash file with Go?