/bin/ksh: bad interpreter: No such file or directory

15,419
  • When a script is executed with ./ the interpreter from the shebang line is invoked.

  • with source the current shell is used (source is a bash extension, so you have to be running bash)

  • with bash script.sh the bash shell in your PATH is invoked with the shellscript.

Share:
15,419

Related videos on Youtube

Nik
Author by

Nik

Updated on September 18, 2022

Comments

  • Nik
    Nik almost 2 years

    I have script with #!/bin/ksh in the first line. When I try to execute this script (run ./myscript.sh) the error occurred:

    -bash: ./myscript.sh: /bin/ksh: bad interpreter: No such file or directory
    

    But when I execute this script through source myscript.sh or bash myscript.sh command - script runs successfully.

    Yes, ksh is not installed and it is correct to install this. But I can't understand different behavior ./ and bash or source