ksh [ HP True 64 v5.1 ] and HP-UX B.11.11i

Hi Friends,

We have migrated our Unix from HP True 64 v5.1 to HP-UX B.11.11i recently and copied all my shell scripts ( Korn shell ) to new HP-UX B.11.11i unix machine. I've encountered lot of errors during execution of the scripts for example:

cat x.sh
#!/usr/bin/ksh
if [ -f abc.txt ]
then
echo abc.txt file exists...
else
echo abc.txt file does not exists...
fi

===============
x.sh: test: argument expected
abc.txt file does not exists...

In my old machine there were no problems, pls advise with how can I overcome from this kind of problems.

Thanks
Krishna

Suppose if I copy ksh file from old machine into my $HOME/bin will it works and how is its behavior?

ksh should be fairly constant across operating systems. The code that you have posted worked fine in FreeBSD. And no, you cannot just take a binary from Tru64 and expect it to work on HP.

I tried that script on ab HP-UX 11i system and I cannot reproduce the error. It works fine for me.