This commit is contained in:
Mark McGranaghan
2012-09-23 11:47:31 -07:00
parent e02b47ea22
commit accda24c6d
13 changed files with 89 additions and 63 deletions

View File

@@ -1,16 +1,17 @@
// ## Spawn
package main
import ("os/exec"; "fmt")
func main() {
cmd := exec.Command("ls", "-a" "-l", "-h")
cmd := exec.Command("ls", "-a", "-l")
out, err := cmd.Output()
if err != nil {
panic(err)
}
fmt.Println("====== Output")
fmt.Println("Files:")
fmt.Print(string(out))
}
// == todo
// full command lines with bash?
// todo: full command lines with bash

6
086-spawn/spawn.sh Normal file
View File

@@ -0,0 +1,6 @@
$ go run spawn.go
Files:
total 8
drwxr-xr-x 3 mmcgrana staff 102 Sep 23 11:35 .
drwxr-xr-x 101 mmcgrana staff 3434 Sep 23 11:25 ..
-rw-r--r--@ 1 mmcgrana staff 241 Sep 23 11:37 spawn.go