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
Windows 10

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…

Yes, I’m using Windows.
I didn’t know that echo is included in many shells… .where did the windows shell commands go?

I really don’t know much about windows… I can barely spell it, also I can start Steam and TeamSpeak…

I’m sorry as well… It was my own lack of knowledge…
I’m sorry I don’t know enough about windows shell commands…
Windows 10 Go 1.15

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("cmd", "/C", "echo "+ cmdinp +" | mecab").Output()
  if err != nil {
        log.Fatal(err)
  }
  fmt.Println(string(cmd))
}