Skip to content

How to Execute Linux Commands in Golang

If you want to execute linux commands in Golang, then you can use exec.Command:

cmd := exec.Command("echo", "hello world") res, _ := cmd.CombinedOutput() fmt.Println(string(res))
Code language: Go (go)

See also  unexpected T_IF
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x