4
我正在编写一个带有解释器的小程序,我想将我的shell无法识别的任何命令都输出到bash中,并打印输出,就像在普通终端中写入一样。管道输入命令行到bash解释器
func RunExtern(c *shell.Cmd) (string, os.Error) {
cmd := exec.Command(c.Cmd(), c.Args()...)
out, err := cmd.Output()
return string(out), err
}
这是我到目前为止写的,但它只能与它ARGS执行一个程序,我想送全行bash和得到输出,任何想法如何做到这一点?
的-c! 我试过只运行bash,应该配备它。 非常感谢:) – 2011-12-22 13:53:10