gobyexample/examples/environment-variables/environment-variables.sh
Mark McGranaghan 5f2b9c42da clarify
2012-10-10 08:51:05 -07:00

21 lines
429 B
Bash

# Running the program shows that we pick up the value
# value for `FOO` that we set in the program, but that
# `BAR` is empty.
$ go run environment-variables.go
FOO: 1
BAR:
# The list of keys in the environment will depend on your
# particular machine.
TERM_PROGRAM
PATH
SHELL
...
# If we set `BAR` in the environemnt first, the running
# program picks that value up.
$ BAR=2 go run environment-variables.go
FOO: 1
BAR: 2
...