Ankur Agarwal
Ankur Agarwal

Reputation: 24768

Accessing original name of file uploaded as a file parameter

I have a simple parametrized Jenkins job that takes a file parameter. However when I try to get its original name in the build step I get a bad substitution error on bash.

Here is the file param Job File Param

Here is the build step Build step

Here are the instructions on getting the name Instructions

The error message I get is:

00:00:00.007 /tmp/jenkins4136900049932701838.sh: 2: /tmp/jenkins4136900049932701838.sh: Bad substitution
00:00:00.011 Build step 'Execute shell' marked build as failure

This is more of a bash question than a Jenkins question, but I wanted to give context to what I am doing.

Any suggestions why I am not able to dereference the variable ?

Upvotes: 0

Views: 1485

Answers (1)

stobiewankenobi
stobiewankenobi

Reputation: 704

The problem here is that your file name does not contain valid characters to be created as a variable.

"." nor "/" are not valid characters in a bash variable so the system cannot save your file name as a variable.

See also since this has been answered before: Access file parameter in jenkins

Upvotes: 1

Related Questions