linux - right click menu item to .sh file.

Discussion in 'Acer Aspire One' started by protoculture, Sep 13, 2008.

  1. protoculture

    protoculture

    Joined:
    Aug 25, 2008
    Messages:
    33
    Likes Received:
    0
    ok, so I have a .sh script that I want to run when doing a right click onto it. I've added a pointer to the .sh file ( which works fine when running in Terminal ), but doesn't seem to when I right click and hit the link in the menu.

    I've tried a direct path like this...

    /mnt/home/Documents/runStopFan.sh

    and also

    /mnt/home/Documents/./runStopFan.sh

    neither seem to work.
     
    protoculture, Sep 13, 2008
    #1
  2. protoculture

    Gleth

    Joined:
    Aug 28, 2008
    Messages:
    16
    Likes Received:
    0
    Try adding 'sh' to the front of the command:

    Code:
    sh /mnt/home/Documents/runStopFan.sh
    When you're running it in a terminal the shell you use knows to run it as a shell script, while your window manager needs to know to run the script with a shell.
     
    Gleth, Sep 14, 2008
    #2
  3. protoculture

    protoculture

    Joined:
    Aug 25, 2008
    Messages:
    33
    Likes Received:
    0
    thanks for the response, but that didn't seem to do it.

    Funny because I can double click the icon that represents the script and it works fine that way.
     
    protoculture, Sep 14, 2008
    #3
  4. protoculture

    Gleth

    Joined:
    Aug 28, 2008
    Messages:
    16
    Likes Received:
    0
    Looking at the path, I think this could be a problem. /mnt is normally used when something (CD drive, USB key etc) is added to the system, but for some reason the file manager opens up with /mnt/home instead of /home/user ...

    Try using /home/user/Documents/runStopFan.sh as the menu entry instead.
     
    Gleth, Sep 15, 2008
    #4
  5. protoculture

    protoculture

    Joined:
    Aug 25, 2008
    Messages:
    33
    Likes Received:
    0
    Nah. that didn't seem to work either. Only a double click on the icon works.

    I tried the various of placing sh ahead as well.
     
    protoculture, Sep 15, 2008
    #5
  6. protoculture

    Gleth

    Joined:
    Aug 28, 2008
    Messages:
    16
    Likes Received:
    0
    Hmm, sorry my ideas didn't work. My next thought would be to check the permissions on the .sh file, and to change them to 755 if they're not already (rwxrwxr-x) (chmod 775 <filename>). After that I'm a bit stumped really.
     
    Gleth, Sep 16, 2008
    #6
  7. protoculture

    rbil

    Joined:
    Aug 14, 2008
    Messages:
    730
    Likes Received:
    0
    Location:
    The Wet Coast, Canada
    Maybe you need to create a .desktop file that launches the script? That's how all the other menu items work.

    Cheers.
     
    rbil, Sep 16, 2008
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.