%x[] gives syntax error

asked 2016-08-01 11:25:47 -0600

Arpitha gravatar image

I need to check for java version on command line and only puppet if its java 8 else fail, so I am trying the below way to capture the command output and compare it with required version, but %x[] gives error saying,

Syntax error at '%'; expected '}'

I am trying the below way:

$is_version = %x(java -version 2>&1 | awk -F '"' '/version/ {print $2}')

if $isversion =~ "1.8.073"{ fail("Java version conflict, hence process terminating...") }

Any help would be highly appreciated.

edit retag flag offensive close merge delete