Execute a ksh file on Unix

Hello,

I have a problem executing a ksh file on Unix. When I run it (./my_file.ksh), I get the following error message:

bad interpreter: a file or a directory in the path name does not exist

What should I add to PATH?

Thank you.

5 answers

  1. Hello,

    ksh my_file.ksh (or /bin/ksh)

    or chmod u+x my_file.ksh then ./my_file.ksh

    If it doesn't work, there is an error in your script.
    3
    1. A small clarification, the ksh executable is correctly defined in PATH (/usr/bin)!
      0
      1. I have another problem:

        Cannot open /data1/Test

        As for permissions, I set it to 777 but it's still not working, do you know where the problem might come from?
        0
        1. Actually, I have a Java program where I run a ksh:

          Runtime.getRuntime().exec(mon_programme.ksh);

          I tested this on another Unix machine and it worked, now it doesn't work anymore and the error is:

          Exception java.io.IOException: mon_programme.ksh not found

          I don't see where the problem comes from since it worked on the other Unix machine.
          0
          1. Instead of using
            Runtime.getRuntime().exec(mon_programme.ksh);
            I used
            Runtime.getRuntime().exec(./mon_programme.ksh);

            and it works
            thank you for your responses ;-)
            0