Re: Append the value of variable into text file

3 views
Skip to first unread message

Danny Jacob

unread,
Jun 12, 2019, 3:46:28 PM6/12/19
to jenkins...@googlegroups.com
String interpolation is being used incorrectly here.
Use just buildnumber instead of $buildnumber.
If you using $buildnumber, use ‘$buildnumber’ instead(in quotes as shown).

On Wed, 12 Jun 2019 at 11:13 PM, panneerrselvam natarajan <pann...@gmail.com> wrote:
Hi All,


I am new to Jenkin and executing the pipeline.. Here i want to store the build number and result in text file.


Here my scripts
f = new file ('pan2.txt")
f.append('newline added!\n)
echo "My file " +f
println f.text


The above scripts adding the content but now i want add the env..build_number into the file

def buildnumber = env.build_number
f.append ($buildnumber) .  (not working).

Please guide me

Regards
Pan



--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f26036a2-9188-4f52-846b-6685f0d5c026%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Best Regards,
Jacob Dany
contact - +65 90224437

Reply all
Reply to author
Forward
0 new messages