shell.go
package main
import (
"os/exec"
)
func exec_shell(s string) {
exec.Command("/bin/bash", "-c", s).Run()
}
func main() {
exec_shell("mkdir test")
}
go fmt shell.go
go build shell.go
./shell
shell.go
package main
import (
"os/exec"
)
func exec_shell(s string) {
exec.Command("/bin/bash", "-c", s).Run()
}
func main() {
exec_shell("mkdir test")
}
go fmt shell.go
go build shell.go
./shell
转载于:https://my.oschina.net/u/4038454/blog/2963898