AIX Shell script does not work

Hi.

I created schell script for sending messages to some processes in AIX:

#!/bin/sh

BSE=/infor/ERPLN/bse
BSE_TMP=/infor/ERPLN/bse/tmp
export BSE BSE_TMP

for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "`
do
/something $i
done

Unfortunatelly this script does not work on one AIX server. I don't know why. The same script works fine on another AIX servers. I tested simmilar script:

#!/bin/sh

BSE=/infor/ERPLN/bse
BSE_TMP=/infor/ERPLN/bse/tmp
export BSE BSE_TMP

for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "`
do
echo $i
done

and this script works fine. I run all commands from script "by hand" and everything is fine.

Any idea why script does not work?

Thanks in advance.

Unfortunately it seems to be something to do with the

/something $i

bit as $i is available in the loop as evidenced by your test.

It should be OK. For every bshell process script has to send message:

/send_message PID1
/send_message PID2
/send_message PID3

....

Regards.

And manual calls to send_message work as expected?

Is there anything we should know about the send_message command (does it spark up a thread in the background and return?)

And manual calls to send_message work as expected? Yes.
Is there anything we should know about the send_message command (does it spark up a thread in the background and return?) No.

Can you try and run the script in debug mode

just inlcude set -x in the script begining

I already did it. Everything looks fine.