I am able to get the following command to open a new terminal and execute the command when I directly input it inside a terminal, but I can not get it to work when I use the exec.Commmand function in go.
osascript -e 'tell application "Terminal" to do script "echo hello"'
I think the issue lies within the double and single quotes, but I am not exactly sure what is causing the error.
c := exec.Command("osascript", "-e", "'tell", "application", `"Terminal"`, "to", "do", "script", `"echo`, `hello"'`)
if err := c.Run(); err != nil {
fmt.Println("Error: ", err)
}
As of now the code is returning Error: exit status 1, but I would like the code to open a terminal window and execute the command.