[Go] golang 执行 Linux 系统 command

执行系统 shell 命令示例:

fileDir := "files/"
out, err := exec.Command("sh", "-c", "ls -alh " + fileDir).Output() if err != nil { panic("cmd error") } log.Println(string(out))

Link:https://www.cnblogs.com/farwish/p/13697256.html

原文地址:https://www.cnblogs.com/farwish/p/13697256.html