1
Goで3つ以上のコマンドをパイプするにはどうすればいいですか(たとえばls | grep | wc)?私は2つのコマンドをパイプするためのものです、このコードを変更しようとしましたが、正しい方法を把握することはできません。、のos.exec()で3つ以上のコマンドをパイプしますか?
package main
import (
"os"
"os/exec"
)
func main() {
c1 := exec.Command("ls")
c2 := exec.Command("wc", "-l")
c2.Stdin, _ = c1.StdoutPipe()
c2.Stdout = os.Stdout
_ = c2.Start()
_ = c1.Run()
_ = c2.Wait()
}
http://stackoverflow.com/a/10953142/3761308
可能性のある重複した[どのようにゴーで、パイプコマンドをいくつかに?](HTTP ://stackoverflow.com/questions/10781516/how-to-pipe-several-commands-in-go) –