When writing a workflow script, what is the best way to assign the output 
of a shell script to a variable in groovy?

For this example, the output is a number that I intend to pass as a 
parameter to another job.

*Example Code:*

node('Builder')
{

dir("/diretory/to/git/REPO")
{

GitCommitCountValue=sh([script: "git rev-list HEAD --count"])

print "Git Commit Count = ${GitCommitCountValue}"

}

}

*Output:*

[REPO] Running shell script
> + git rev-list HEAD --count
> 99
> Running: Print Message
> GIT COMMIT COUNT = 0



Thank you in advance,
Vizionz

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/79c1471d-f7b9-4202-a8a3-3fb55d268f52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to