This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-02
Channels
- # aleph (6)
- # beginners (37)
- # boot (415)
- # cider (17)
- # cljs-dev (79)
- # cljsjs (3)
- # cljsrn (18)
- # clojars (3)
- # clojure (34)
- # clojure-france (6)
- # clojure-italy (1)
- # clojure-korea (1)
- # clojure-russia (22)
- # clojure-spec (64)
- # clojure-uk (47)
- # clojurebridge (6)
- # clojurescript (61)
- # clojurex (1)
- # cloverage (11)
- # component (6)
- # cursive (73)
- # data-science (6)
- # datascript (4)
- # datomic (38)
- # editors (1)
- # emacs (4)
- # events (16)
- # funcool (5)
- # garden (3)
- # hoplon (17)
- # jobs (2)
- # klipse (74)
- # off-topic (3)
- # om (81)
- # onyx (35)
- # parinfer (4)
- # pedestal (1)
- # perun (20)
- # planck (9)
- # proton (1)
- # re-frame (17)
- # reagent (3)
- # ring-swagger (1)
- # rum (7)
- # untangled (63)
- # vim (8)
Hi, how can I get value of an env variable? I tried (planck.shell/sh "echo" "$HOME”)
, but it returns {:exit 0, :out "$HOME\n", :err “”}
.
@honzabrecka One approach would be to parse the response of the env
command.
FWIW, Planck behaves like Clojure for this use case:
user=> (clojure.java.shell/sh "echo" "$HOME")
{:exit 0, :out "$HOME\n", :err “”}
@mfikes Thanks, I’ll go that way. In clojure we have System/getenv
.
@honzabrecka See parsing code here: https://github.com/mfikes/planck/issues/165#issuecomment-159069195
It essentially supports your exact use case, resulting in
cljs.user=> (get (env.core/get-env) "HOME")
“/Users/mfikes”
Thanks. Just a note, it won’t work with variable that contains =
, eg. some base64 encoded value.
@honzabrecka Thanks! I fixed the example parsing code there for that issue.