Take the following script:
if [ foo == foo ]; then
echo foo is foo
fi
if [ foo == bar ]; then
echo foo is bar
fi
When I run this from the Linux command line, I get:
foo is foo
When I add “#!/bin/bash –ex” as a shebang, I get the expected line dump plus the “foo is foo” line.
When I make this an “execute shell” build step, and run that step on a linux slave, I get:
[bash hard bracket test] $ /bin/sh -xe /tmp/hudson942109571990858458.sh
+ [ foo == foo ]
/tmp/hudson942109571990858458.sh: 2: [: foo: unexpected operator
+ [ foo == bar ]
/tmp/hudson942109571990858458.sh: 6: [: foo: unexpected operator
When I add a “#!/bin/bash” to the step as a shebang, I just get the expected “foo is foo” line. And if I add a “#!/bin/bash –ex” shebang to the step, I get the same thing that I get when running the script with the shebang from the command line.
In any case, whenever I run this as a build, the SHELL environment variable is “/bin/bash”
Why does running a shell step without a shebang behave differently than it does with a “#!/bin/bash –ex” shebang? Exactly what is being run without a shebang?
Thanks in advance,
--Rob Mandeville
Deka Research and Development
Why does running a shell step without a shebang behave differently than it does with a “#!/bin/bash –ex” shebang? Exactly what is being run without a shebang?

I’m using Ubuntu, and have never heard of dash (though I just checked and verified that /bin/sh is a symlink to it). Are you saying that, if no shebang is given, the build step ignores the SHELL variable and runs /bin/sh –ex? This would explain much.
--Rob
Click here to report this email as spam.
--
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/55DC7498.70609%40recommind.com.
For more options, visit https://groups.google.com/d/optout.