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

________________________________
This e-mail and the information, including any attachments it contains, are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0A40042D85E7C84DB443060EC44B3FD36D9CB15FFE%40dekaexchange07.deka.local.
For more options, visit https://groups.google.com/d/optout.

Reply via email to