Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Unhappy How to execute a shell script by clicking on it?

    I have been looking in a few places and found about the same response.
    'you need to set execute permissions and run it from a terminal/console/something-that-involves-more-typing'

    The point here should be obvious - the big competitor, M$, allows for a simple double click on a executable file type (or batch file/cmd file/java file and then runs it in the best context for it without having to open up a command shell and start typing more commands in.

    Having made the file executable in linux via permissions, there should be a simple way of just double clicking and getting what you want - a running process doing its thing.

    When we get to that bit it all goes quiet with shrugging of virtual shoulders...

    I tried creating a shortcut and editing the launch parameters to open with Konsole, that didnt work.
    I tried editing the shellcommand file properties to add another action - run using Konsole... but that give the following error (konsole(10547): Attempt to use QAction "change-profile" with KXMLGUIFactory!), I tried a shortcut with just the java command line on, I get launch feedback (coffee bean bouncing) and then nothing.

    Why is it so DIFFICULT???
    In my case I am trying to get 'backstage-v1.1' java applet to display rss feeds on a desktop. It would be better if it was without a console session open all the time... but basically the same deal as this guy has.

    Oh and BTW, I don't want to use RSSNOW because it corrupts its display...

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    Moving to a more appropriate forum.

    The short answer is that every GUI file manager I've ever heard of does allow you to execute programs by just double-clicking on them. I don't run KDE, so I can't help you with specifics, but hopefully somebody else can.

  3. #3
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Mumbai, India
    well it works fine for me. I created a simple script from console , made it executable through console , went and double clicked on it. Then chosed to run it in terminal . That''s it.
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  4. $spacer_open
  5. #4
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Quote Originally Posted by vickey_20 View Post
    well it works fine for me. I created a simple script from console , made it executable through console , went and double clicked on it. Then chosed to run it in terminal . That''s it.
    I can do this too. A good way is to make your script, set it as executable and create a shortcut to it - a desktop shortcut, not a symlink. Then you can launch with the desktop shortcut.

    I have to caution you about criticising Linux for not being Windows. Things work they way they do because that's how the community want them to work and because they are technically sound decisions. Don't assume that it's a lacking design. There are reasons for things working this way and those who know the system wouldn't have it any other way. There is a reason after all that Linux is generally speaking more secure than Windows.

  6. #5
    Linux Newbie egan's Avatar
    Join Date
    Feb 2009
    Mountain View, CA
    Maybe you need to include the shabang? i.e.


    for bash. In Linux, the file extensions are very flexible, and the filemanager might not know that a *.sh is script file unless it starts with the correct magic two-byte number, which in the case of shell scripts is #!, the path to the interpretor in turn helping the shell pass it to the correct shell.

  7. #6
    Join Date
    May 2004
    arch linux
    Don't know why they aren't working for you, but there have been several scripts in the past that I've wanted to execute from clickable shortcuts and after setting them up to do just that, they all worked worked fine in Gnome, KDE, and Xfce4.

  8. #7
    Just Joined! Mistoffeles's Avatar
    Join Date
    Jul 2006
    Northern BC, Canada
    1) Linux scripts don't generally use extensions, so you have to tell the shell what program is needed to run it by inserting the shebang (#!/bin/bash or similar).

    2) Linux files by default are created as not-executable. This is better than Windows, because it is more secure, you can't run anything until you actively do something to tell the OS that you want the file to be executable. Since Server 2003, Microsoft has done the same thing with files introduced to a machine over the network, you can't run anything without "approving it", and you have to do that over and over until you go into the properties and turn this security off, much more annoying than typing in one simple command in a console once ever. This even applies to data files that can contain dangerous code, such as files labelled as .jpg but actually containing malicious SQL or WSS code.

    3) It's not so difficult once you know the simple and easy to use commands to edit file permissions. For a Linux system that is not configured with SELinux, the only commands you need are chmod and chown (change mode and change owner). I don't recommend using SELinux at this point, as it is much more complicated and you don't need it at this point.

    chmod sets the file permissions that you see when you list the files in a directory (list view in the GUI, or using the ls command in a terminal console). You can learn how to use it here:

    chmod MAN Page

    Or you can go here to read a much simplified (so simplified it has to teach you a metaphor that actually interferes with a proper understanding of how it works, but good enough for someone who never wants to really know how it works) explanation of how it works.

    Unix for dummies - Google Books

    Of course, you can set permissions in a list mode folder window, but to know what you are setting you have to know what's actually happening, not the Dummies book shortcut.

    P.S.: Microsoft is not in any way a competitor to Linux, except in their own minds and the minds of those who have been brainwashed with their Fisher Price method of using a computer.

  9. #8

    How to execute a shell script by clicking on it?

    Thanks to all that have commented here, I will explore these directions shortly.

    For the benefit of anyone curious about this I found a solution that worked well for this scenario - that is to launch a java applet.

    In KDE I used the menu editor (right click on the 'fedora' menu button->Menu Editor)
    navigate to the desired sublevel (in my case 'Internet')
    Click on 'New Item'
    Give it a name and click OK
    Hilight the new item in the menu list
    on the right hand pane, select the tab for 'General'
    Fill in the 'Command' edit box with the desired command in my case it was as follows:
    java -jar backstage-v1.1.jar
    select the 'Advanced' page
    fill in the 'Work path:' edit box with the location of the target jar file - in my case it was as follows:

    Close the menu editor and save the changes.
    The new item on the menu can be used to launch the java applet without the need for a script or having a command shell open.

    Now... I need to find out why I cannot launch shell scripts from MY gui as apparently everyone else CAN?!!

  10. #9

    How to execute a shell script by clicking on it?

    Ok, I revisited the script option and here is what I found:

    I created a new file:
    vim (yes I know extensions are not necessary or identified by Linux, but habit etc.)
    i to enter insert mode
    and added the following lines:
    java -jar backstage-v1.1.jar

    saved the file (esc, shift-ZZ)
    file is there, from a console I issue the following command:
    chmod 777

    ls -l shows the following:
    [jez@localhost backstage-v1.1-bugfix]$ ls -l
    -rwxrwxrwx 1 jez jez 41 2009-07-08 14:26

    file is there available to everyone, executable so I should now be able to go find it with Dolphin or Konq and double click it to launch it right?

    Wrong - nothing happens at all. Hightlight the file entry and press enter - nothing,
    Right click and select 'Open With->Konsole' results in the following message in console:
    konsole(15883): Attempt to use QAction "change-profile" with KXMLGUIFactory!

    So something with my system is screwed right?

  11. #10
    Just Joined! Mistoffeles's Avatar
    Join Date
    Jul 2006
    Northern BC, Canada
    What are the permissions on the shortcut itself?

Posting Permissions

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