Reputation: 19123
I am trying this groovy one-line its not working. Any idea how to make this work?
groovy -e 'def env=System.getenv();println( env['HOME'])'
Caught: groovy.lang.MissingPropertyException: No such property: HOME for class: script_from_command_line
groovy.lang.MissingPropertyException: No such property: HOME for class: script_from_command_line
at script_from_command_line.run(script_from_command_line:1)
Thanks SR
Upvotes: 1
Views: 551
Reputation: 28634
groovy -e "def env=System.getenv();println( env['HOME'])"
just use different quotes for string and for whole command
other ways
groovy -e "def env=System.getenv();println( env.HOME )"
groovy -e "println System.getenv().HOME"
groovy -e "println(System.env.HOME)"
Upvotes: 6