PHP
·
发表于 5年以前
·
阅读量:8283
package main
import (
"fmt"
"os/exec"
)
func main(){
command := `./dir_size.sh .`
cmd := exec.Command("/bin/bash", "-c", command)
output, err := cmd.Output()
if err != nil {
fmt.Printf("Execute Shell:%s failed with error:%s", command, err.Error())
return
}
fmt.Printf("Execute Shell:%s finished with output:\n%s", command, string(output))
}