cmd := exec.Command("ls") if err := cmd.Run(); err != nil { log.Fatal(err) }
cmd := exec.Command("/bin/sh", "myscript.sh", "arg1", "arg2") if err := cmd.Run(); err != nil { log.Fatal(err) }
cmd := exec.Command("mycommand") cmd.Env = []string{"VAR1=value1", "VAR2=value2"} if err := cmd.Run(); err != nil { log.Fatal(err) }These examples show the usage of the `os/exec` package in Go for executing commands. The `os/exec` package is part of the standard library in Go.