func main() {
	commands := []string{"date", "whoami", "date ; whoami", "date & whoami"}

	for _, command := range commands {

		output, error := exec.Command(command).Output()

		if error != nil {
			log.Printf("[ERROR] %s", error)
			continue
		}

		log.Printf("$ %s -> %s", command, output)
	}
}
// Execute OS command.
// ----------------------------
// - single command
// - joined command
Execute OS command.

- single command
- joined command
// Execute OS command . // ---------------------------- // - single command // - joined command
func main() {
	commands := []string{"date", "whoami", "date ; whoami", "date & whoami"}
	for _, command := range commands {
		output, error := exec.Command(command).Output()
		if error != nil {
			log.Printf("[ERROR] %s", error)
			continue
		}
		log.Printf("$ %s -> %s", command, output)
	}
}
func main ( ) { commands := [ ] string { " " , " " , " " , " " } for _ , command := range commands { output , error := exec . Command ( command ) . Output ( ) if error != nil { log . Printf ( " " , error ) continue } log . Printf ( " " , command , output ) } }
Execute OS command.
Execute OS command .