Search code examples
shellubuntush

.sh File Not Found


I'm trying to execute test.sh on terminal.

My test.sh is in the /Home/monty folder and I made it executable:

chmod 755 test.sh

I try to execute it using: $./test.sh I get an error:

bash: ./test.sh: /usr/bin/bash: bad interpreter: No such file or directory

I tried to do this on terminal:

$ PATH=$PATH:/Home/monty

But to no avail. How do I solve this issue?


Solution

  • You probably have set the wrong shabang. In ubuntu bash is normally located in /bin/bash so at the top of the file you should have:

    #!/bin/bash
    

    instead of:

    #!/usr/bin/bash
    

    Another way to run the script is to just tell bash (or sh) to execute it:

    bash ./test.sh