Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: File association for .sh all screwed up ?

  1. #1

    Default File association for .sh all screwed up ?

    I can not run any scripts from within dolphin or a desktop icon.

    Only from a console.

    What is the deal ?

    This is getting old. :-(
    Thanks, Andy

    openSUSE 13.1 KDE (x86_64)
    Puppy Slacko 5.6.0
    Occasionally Windows XP

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,375
    Blog Entries
    1

    Default Re: File association for .sh all screwed up ?

    Quote Originally Posted by andy77586 View Post
    I can not run any scripts from within dolphin or a desktop icon.

    Only from a console.

    What is the deal ?

    This is getting old. :-(
    I'm not sure if I understand you.

    If I create a test script eg test.sh
    Code:
    #!/bin/bash
    kdialog --msgbox "hello"
    and make it executable
    Code:
    chmod +x test.sh
    then click on my script (in my home directory), it executes without issue, displaying a dialogue box with 'hello' as expected. Perhaps you need to share your script with us.

  3. #3
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,054

    Default Re: File association for .sh all screwed up ?

    On Sat, 31 May 2014 23:06:01 +0000, andy77586 wrote:

    > I can not run any scripts from within dolphin or a desktop icon.
    >
    > Only from a console.
    >
    > What is the deal ?
    >
    > This is getting old. :-(


    Please describe what is happening and what, if any, error messages you
    get.

    Jim

    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  4. #4

    Default SOLVED Re: File association for .sh all screwed up ?

    I found the problem.

    #!/bin/bash has to be the first line in OpenSuse.

    Was not the case in other distros as in Puppy and Mint.

    Thanks guys. :-)
    Thanks, Andy

    openSUSE 13.1 KDE (x86_64)
    Puppy Slacko 5.6.0
    Occasionally Windows XP

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,609
    Blog Entries
    3

    Default Re: SOLVED Re: File association for .sh all screwed up ?

    Quote Originally Posted by andy77586 View Post
    I found the problem.

    #!/bin/bash has to be the first line in OpenSuse.

    Was not the case in other distros as in Puppy and Mint.

    Thanks guys. :-)
    It works for me.

    Here's the shell script that I used:
    Code:
     echo "hello world"
    Note that the first line is blank. Sigh -- the first line is being stripped out. That's not good, particularly in a code block.

    If I do not set the "x" bit (executable permission), then Dolphin opens it in a text editor.

    If I do set the "x" bit, Dolphin executes it, and I can see the output at the end of the file ".xsession-errors-:0" in my home directory.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  6. #6
    Join Date
    Nov 2013
    Location
    Canadiana
    Posts
    461

    Default Re: SOLVED Re: File association for .sh all screwed up ?

    Quote Originally Posted by andy77586 View Post
    I found the problem.

    #!/bin/bash has to be the first line in OpenSuse.

    Was not the case in other distros as in Puppy and Mint.

    Thanks guys. :-)
    So I was right in the other thread?
    openSUSE Leap (42.1) 64 bit
    Plasma 5.4

  7. #7

    Default Re: SOLVED Re: File association for .sh all screwed up ?

    Quote Originally Posted by andy77586 View Post
    I found the problem.

    #!/bin/bash has to be the first line in OpenSuse.

    Was not the case in other distros as in Puppy and Mint.

    Thanks guys. :-)
    If you did not put a shebang on your script then it is just another text file, it is just a an example of the wrong idea about the *.sh extension in general.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,128

    Default Re: SOLVED Re: File association for .sh all screwed up ?

    Quote Originally Posted by jetchisel View Post
    If you did not put a shebang on your script then it is just another text file, it is just a an example of the wrong idea about the *.sh extension in general.
    Correct, there is no such thing as an "extension" in Unix/Linux. When you use a suffix like this, it is for your own brains and may be it is recognised by some applications (like the desktop). But in fact .sh are just the three last characters of the file name.

    And yes, when you write a script, the first line should be a shebang. How could anyone (the system in the first place) know which interpreter to start to interprete the script? Is it ksh, bash, sh, zsh, perl, .............?
    Henk van Velden

  9. #9
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,609
    Blog Entries
    3

    Default Re: SOLVED Re: File association for .sh all screwed up ?

    Quote Originally Posted by hcvv View Post
    And yes, when you write a script, the first line should be a shebang. How could anyone (the system in the first place) know which interpreter to start to interprete the script? Is it ksh, bash, sh, zsh, perl, .............?
    As far as I know, there's a defacto standard. If the first line is a comment, use "csh". Otherwise use "sh". This is implemented by shells, not by execv(). With the "#!" line, execv() handles it.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,128

    Default Re: SOLVED Re: File association for .sh all screwed up ?

    Quote Originally Posted by nrickert View Post
    As far as I know, there's a defacto standard. If the first line is a comment, use "csh". Otherwise use "sh". This is implemented by shells, not by execv(). With the "#!" line, execv() handles it.
    Sorry, you may be correct, but I do not understand what you try to explain. Can elaborate a bit (with examples when possible)?
    Henk van Velden

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •