Prompt as in golang to execute such command:
/bin/bash script.sh < text.txt
I execute a script with parameters so:
package main
import (
"fmt"
"os/exec"
"log"
"os"
)
func main() {
argstr := []string{"script.sh", "arg1", "arg2"}
out, err := exec.Command("/bin/bash", argstr...).Output()
if err != nil {
log.Fatal(err)
os.Exit(1)
}
fmt.Println(string(out))
}
And here is how to transfer an output from the text file?