Replace ${mytime} with \$mytime

The mytime variable you've created is a bash one.

Regards
Daniel


On Thu, 2 May 2019, 1:16 pm b o b i, <[email protected]> wrote:

> Jenkins 2.174, in a scripted pipeline the following
>
> sh """#!/bin/bash
>            echo "TTTTTTT"
>            mytime="`date '+%Y_%m_%d__%H_%M_%S'`"
>            echo ${mytime}
>         """
>
> produces
>
> groovy.lang.MissingPropertyException: No such property: mytime for class: 
> groovy.lang.Binding
>       at groovy.lang.Binding.getVariable(Binding.java:63)
>       at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270)
>       at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289)
>       at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:293)
> ...
>
> How can I have current time expanded as a string without the above error?
>
> --
> 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/3b826017-27f1-45c9-925c-f396b13bcea9%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/3b826017-27f1-45c9-925c-f396b13bcea9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAO37hbgohHtkAeVoY-7BWJAkyiwqdqiUYmK65na%2B07s3wwoRHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to