not an identifier

Hi

I have already gone through this topic on this forum, but still i am getting same problem.
I am using solaris 10. my login shell is /usr/bash
i have got a script as below

/home/gyan> cat 3.cm
#!/usr/bin/ksh
export PROG_NAME=rpaa001

if i run this script as below , it works fine

/home/gyan> 3.cm

But if i run this as below, it gives error

/home/gyan> sh 3.cm
3.cm: PROG_NAME=rpaa001: is not an identifier

I know that korn shell syntex is export variable_name=value and i have set interpretator as korn shell only.
Please let me know where i am wrong.

Thanks and regards
Gyan

What's the output of

type sh
which sh

Reason for asking: if you run a script using an explicit interpreter ('sh' in your example), you tell the system to ignore the interpreter specified in the shebang line. If your local sh isn't compatible with the Korn Shell, it won't know what to do with that line.

Hi, you have to still use ksh, since apparently your sh does not support that syntax.

ksh 3.cm

The shebang does not get interpreted when the script is called this way.

Hi
output is

/home/gyan> type sh
sh is hashed (/usr/bin/sh)
/home/gyan> which sh
/usr/bin/sh

So basically, if we are using shell command interpreter in scripts then shouldn't run the script with any shell. Should simple run by typing name of script?

thanks
gyan