Am Dienstag, 6. März 2018 12:53:06 UTC+1 schrieb Samuel Mutel:
>
> Hello,
>
> I would like to define a variable in shell and to use it.
> How can I do this?
>
> For example:
>
> sh "find packages -name internal-* -type d -exec bash -c 'for arg; do 
> export VERSION=\$(grep \${arg##*/} nexus-cicd-versions.txt | cut -d: 
> -f2);sed -i \'s/#VERSION#/${env.VERSION}/g\' \$arg/0/package.json; done' _ 
> {} +"
>
> The content of VERSION is the result of a grep from file. I displayed the 
> variable, it works.
> Now I would like to use VERSION in the sed part. But I am not able to get 
> the value of VERSION.
> I tried ${env.VERSION}, ${VERSION}, $VERSION, ...
>
>
So you want the $VERSION you defined in the shell: 
The you need to use \$VERSION or \${VERSION} I guess. 

Otherwise you would try to use the groovy variable (that probably does not 
even exist).

Björn
 

> Thanks for your help on this topic.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2696d7de-e794-40de-a604-b2440151108e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to