Execute a system command: Difference between revisions

→‎{{header|Go}}: library change
(→‎{{header|UNIX Shell}}: Important fixes: `ls` is Bourne Shell, $(ls) is Korn Shell.)
(→‎{{header|Go}}: library change)
Line 223:
 
func main() {
cmd := exec.Command("ls", "-l")
cmd, err := exec.Run("/bin/ls", []string{"/bin/ls"}, []string{}, "", exec.DevNull, exec.PassThrough, exec.PassThrough)
output, err := cmd.Output()
if (err != nil) {
fmt.Println(err)
return
}
fmt.Print(string(output))
cmd.Close()
}</lang>
 
Anonymous user