Chirag Dhyani
Chirag Dhyani

Reputation: 1063

Shell script wont execute on jenkins however manually it will

This appears to be a really weird issue. I am using Jenkins for automating compilation and build creation. I have a shell script which when I execute manually on gitserver, it is fine but the same script through Jenkins displays error:

Error:

/tmp/hudson829990263989049539.sh: 2: build/envsetup.sh: Syntax error: "(" unexpected

Content of the shell script(envsetup.sh):

#!/bin/sh
function hmm()
{
cat <<EOF
..................

Command used for manual as well as with Jenkins:

. build/envsetup.sh

I tried various methods e.g. changing the path for script execution, chown and then execute, dos2unix etc but nothing appears to work till now.

Any idea on this? Thanks in advance.

Upvotes: 0

Views: 1068

Answers (2)

Chirag Dhyani
Chirag Dhyani

Reputation: 1063

The issue got resolved when I put

#!/bin/bash

in the the build steps in Jenkins.

Upvotes: 2

mahinlma
mahinlma

Reputation: 1248

Run your shell script with sudo .

sudo .build/eventsetup.sh

Upvotes: 0

Related Questions