Why is my shell script not executing?

6,055

The error has nothing to do with gedit and/or nano. Your script call is a bit wrong. This error occurs, if you start sh with an non-existing file in the current folder. Therefore start your script with a full path:

sh /path/to/your/script.sh

or change your current folder and start your script inside this folder:

cd /path/to/your
sh script.sh
Share:
6,055

Related videos on Youtube

Linuxuser001
Author by

Linuxuser001

Updated on September 18, 2022

Comments

  • Linuxuser001
    Linuxuser001 over 1 year

    I executed it in terminal using:

    sh script.sh
    

    And I get this error:

    sh: 0 can't open script.sh 
    
    • AlexGreg
      AlexGreg over 8 years
      ls -l to where your script resides?
    • steeldriver
      steeldriver over 8 years
      FYI sh does not "execute the script in bash" - it executes it in sh, which by default is dash on Ubuntu systems: see DashAsBinSh