Cannot execute .sh script

  • I can't get my very simple script executed from the ssh terminal on LE v7.90.008:

    If the #!/bin/sh tag is removed then the result is OK, however I cannot create real .sh scruipt without this tag.

    Edited once, last by sakos (November 6, 2016 at 9:15 PM).

  • Your initial file test.sh in folder sleep.d is DOS formatted and not UNIX like it should be.

    Code
    dos2unix ~/.config/sleep.d/test.sh

    Edited once, last by vpeter (November 6, 2016 at 6:17 PM).



  • Thank you Peter! :angel:

    so i have the following file:
    ~/.config/sleep.d/01-restart.power

    i chmod 755 and also dos2unix.

    it still wont restart kodi on wake from sleep.

    file contents:

    Code
    #!/Bin/sh! 
    Case "$ 1" in 
    pre) 
    ;; 
    post) 
    systemctl restart kodi 
    ;; 
    Esac

    am i doing something wrong? thanks!

  • so i have the following file:
    ~/.config/sleep.d/01-restart.power

    i chmod 755 and also dos2unix.

    it still wont restart kodi on wake from sleep.

    file contents:

    Code
    #!/Bin/sh! 
    Case "$ 1" in 
    pre) 
    ;; 
    post) 
    systemctl restart kodi 
    ;; 
    Esac

    am i doing something wrong? thanks!


    syntax matters

    Bash
    #!/bin/sh 
    case "$1" in 
      pre) 
        ;; 
      post) 
        systemctl restart kodi 
        ;; 
    esac