I am having a very odd problem. I've written a shell script on a RHEL box for deploying application components (internally written ones). I need to pass variables which are assigned values in a loop back to the main script. I had problems using the following loop construct...

cat file | while read line

do

something

retval=$?

done

echo $retval

so I had to change the loop to be like this...

while read line

do

something

retval=$?

done < <(cat file)

echo $retval

However, I wrote and tested this script on my RHEL server, and once I was happy with it, copied and pasted the contents into a BlPackage. When I try to run it through bladelogic however, it bombs out with a syntax error (unexpected < near token ( or something).

I took a look at the bldeploycmd.bat on in the staging area on the machine. I noticed that BladeLogic sticks #!/bin/sh as the first line of the bldeploycmd.bat.

If I do this - /bin/bash bldeploycmd.bat the script works.

But if I do this /bin/sh bldeploycmd.bat or just ./bldeploycmd.bat it fails with the same syntax error.

But the really weird thing is that on this machine /bin/sh is just a symbolic link to /bin/bash!