Golang os/exec.Cmd.Output() function example
package os
Golang os/exec.Cmd.Output() function usage example
package main
import (
"fmt"
"os/exec"
)
func main() {
// Create an *exec.Cmd
output, err := exec.Command("echo", "Hello World!").Output()
if err != nil {
panic(err)
}
fmt.Printf("Command output : %s \n", output)
}
Reference :
Advertisement
Something interesting
Tutorials
+19.3k Golang : Calculate entire request body length during run time
+4.6k Mac OSX : Get disk partitions' size, type and name
+37.5k Golang : Converting a negative number to positive number
+19k Golang : Padding data for encryption and un-padding data for decryption
+6k Fontello : How to load and use fonts?
+15.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+11.2k Golang : Fix - does not implement sort.Interface (missing Len method)
+11.7k Golang : Gorilla web tool kit secure cookie example
+16.6k Golang : Generate QR codes for Google Authenticator App and fix "Cannot interpret QR code" error
+31.6k Golang : Get local IP and MAC address
+5.9k AWS S3 : Prevent Hotlinking policy
+9k Golang : Inject/embed Javascript before sending out to browser example