go linux 命令执行问题

5kill · 2017-07-25 06:17:41 · 2229 次点击

对,所以要执行 history这样 内部命令 不能用这样方式么? top 确实是动态的 有木有linux 命令的操作方式呢。

#2
更多评论

history 不是一个 linux 命令,而是 bash 内部的一个命令吧。top 因为是交互式的?

#1
cmd := exec.Command("/bin/bash","-c","cat ~/.bash_history")

这样是可以获取到了 history 命令了 多谢@channel 提醒。

#3