Inside groovy, I want to write a shell script that parses the output of
some shell command and get some string value back. How can I get the value
of the shell command?

For example say I want to get the file size of some_file, I'll do

x = sh returnStatus: true, script: '''
  IFS=" " read -ra LINE <<< `ls -al | grep some_file`
  echo ${LINE[4]}
'''

How can I store the value of ${LINE[4]} in a groovy variable to use later?

Thanks,
Chris

Reply via email to