diff --git a/README.md b/README.md index 0af7193..00b727f 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Aggregation Using merge-with](clojure/aggregation-using-merge-with.md) - [Evaluate One Liners With lein-exec](clojure/evaluate-one-liners-with-lein-exec.md) - [Expanding Macros](clojure/expanding-macros.md) +- [Get The Value Of An Environment Variable](clojure/get-the-value-of-an-environment-variable.md) - [Open JavaDocs](clojure/open-javadocs.md) - [Pretty Print The Last Thing](clojure/pretty-print-the-last-thing.md) - [Quick Clojure Docs](clojure/quick-clojure-docs.md) diff --git a/clojure/get-the-value-of-an-environment-variable.md b/clojure/get-the-value-of-an-environment-variable.md new file mode 100644 index 0000000..6ca9db5 --- /dev/null +++ b/clojure/get-the-value-of-an-environment-variable.md @@ -0,0 +1,16 @@ +# Get The Value Of An Environment Variable + +You can get the value of an environment variable on your system using the +`System/getenv` function. Just pass it the environment variable as a string: + +```clojure +> (System/getenv "HOME") +"/Users/jbranchaud" +``` + +It returns `nil` when the environment variable doesn't exist. + +```clojure +> (System/getenv "HOUSE") +nil +```