$ curl http://baidu.com | grep 'bai' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 81 100 81 0 0 131 0 --:--:-- --:--:-- --:--:-- 131 <meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
funcmain() { fileInfo, _ := os.Stdin.Stat() fmt.Println(fileInfo.Mode(), os.ModeNamedPipe, os.ModeNamedPipe) if (fileInfo.Mode() & os.ModeNamedPipe) != os.ModeNamedPipe { log.Fatal("The command is intended to work with pipes.") } s := bufio.NewScanner(os.Stdin) for s.Scan() { fmt.Println(s.Text()) } }