Original post

I want to use the echo command ‘’‘exec: “echo centric” cmdinp | mecab””: executable file not found in %PATH%
I get the error “exit status 1’’’
I would like to execute the command as it is, but I get an error.Or is it a low version?

import (
        "bufio"
        "fmt"
        "log"
        "os"
        "os/exec"
)

func main(){
  fmt.Printf("Please enter.n")
  var (
        input string
  )
  fmt.Scan(&input)
  cmdmecab(input)
}

func cmdmecab(cmdinp string){
  cmd, err := exec.Command("echo " cmdinp | mecab"").Output()
  if err != nil {
        log.Fatal(err)
  }
  fmt.Println(string(cmd))
}

Go 1.15

exec.Command wants the command (binary, executable) to run and then the args in distinct arguments, eg exec.Command("echo", "foo") will print foo to the stdout of the command beeing run.

So what you want is exec.Command("echo", " cmdinp | mecab").

Be aware that echo is a built-in in many shells and does not necessarily exist in you PATH. In such a case you need to use exec.Command("bash", "-c" `echo " cmdinp | mecap"`).

And as it seems that you use windows, things can become arbitrarily more complicated…