Command not found error on bash build script

102 views
Skip to first unread message

Gouri Nair

unread,
Dec 2, 2015, 11:38:53 AM12/2/15
to Jenkins Users
I added a simple if else statement as a part of my bash script.

if [[ $xml_name = "xmlnew" ]]
then
    partnerfolder = "update"
else
    partnerfolder = $partner
fi

and when i run the build job, i get this error.
+ [[ xmlnew = \x\m\l\n\e\w ]]
+ partnerfolder = update
/tmp/hudson3128957863523275001.sh: line 21: partnerfolder: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Can someone tell me what could be wrong?
There are other jobs running on the same jenkins with if-else statements and they seem to be working. Please help!!

Daniel Beck

unread,
Dec 2, 2015, 12:01:02 PM12/2/15
to Jenkins Users

On 02.12.2015, at 17:38, Gouri Nair <gouri...@gmail.com> wrote:

> Can someone tell me what could be wrong?

Has absolutely nothing to do with Jenkins. It's just invalid bash syntax. Get rid of the space around the '=' char.

In the future, try whether what you're doing works outside Jenkins before asking for help. If it doesn't work there either, it's likely unrelated to JEnkins.

John Mellor

unread,
Dec 2, 2015, 12:24:08 PM12/2/15
to jenkins...@googlegroups.com

Gouri quoted:

. . .

then

    partnerfolder = "update"

. . .

 

Why do you have spaces around the assignment operator?  That’s not legal in bash or any other normal shell language.

--
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/63d8c0d9-4b7d-4452-a6c5-f724c8859952%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gouri Nair

unread,
Dec 2, 2015, 12:53:13 PM12/2/15
to Jenkins Users, m...@beckweb.net
Thank you. I will keep that in mind.

Gouri Nair

unread,
Dec 2, 2015, 12:54:06 PM12/2/15
to Jenkins Users, John....@esentire.com
Thank you. I will get rid of the spaces. I am new to bash scripting hence i made that mistake.
Reply all
Reply to author
Forward
0 new messages