This commit is contained in:
Mark McGranaghan
2012-09-18 21:45:44 -07:00
parent f1b5e45784
commit ebcadd96c3
2 changed files with 21 additions and 1 deletions

17
src/xx-env.go Normal file
View File

@@ -0,0 +1,17 @@
package main
import ("os"; "fmt"; "strings")
func main() {
for _, e := range os.Environ() {
pair := strings.Split(e, "=")
fmt.Println(pair[0], pair[1])
}
fmt.Println()
fmt.Println(os.Getenv("PWD"))
fmt.Println()
os.Setenv("FOO", "bar")
fmt.Println(os.Getenv("FOO"))
}