How to execute sh script from a desktop shortcut?












29















Im trying to make a shortcut to login my ssh server:



ssh x.x.x.x


I made the following file:



ssh_home.sh


Made it executable:



sudo chmod +x ./ssh_home


Checked by right clicking properties to check if it was executable and it was..



But whatever I do, when double clicking it, it will launch gedit.
I tried "Open With" but no terminal app is shown there.
I searched the net but only found a way to link to the file while not integrating it in one "shortcut file"










share|improve this question




















  • 2





    Did you add #! /usr/bin/sh at the beginning of the file (the first line)?

    – Misery
    May 23 '13 at 11:50













  • Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...)

    – Jez W
    May 23 '13 at 11:59













  • Also check owner and permissions. Does user clicking it have permission to run it?

    – Misery
    May 23 '13 at 12:04






  • 1





    Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files.

    – l0b0
    May 23 '13 at 12:04






  • 1





    @Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>)

    – Keith Thompson
    Jul 10 '15 at 21:05
















29















Im trying to make a shortcut to login my ssh server:



ssh x.x.x.x


I made the following file:



ssh_home.sh


Made it executable:



sudo chmod +x ./ssh_home


Checked by right clicking properties to check if it was executable and it was..



But whatever I do, when double clicking it, it will launch gedit.
I tried "Open With" but no terminal app is shown there.
I searched the net but only found a way to link to the file while not integrating it in one "shortcut file"










share|improve this question




















  • 2





    Did you add #! /usr/bin/sh at the beginning of the file (the first line)?

    – Misery
    May 23 '13 at 11:50













  • Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...)

    – Jez W
    May 23 '13 at 11:59













  • Also check owner and permissions. Does user clicking it have permission to run it?

    – Misery
    May 23 '13 at 12:04






  • 1





    Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files.

    – l0b0
    May 23 '13 at 12:04






  • 1





    @Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>)

    – Keith Thompson
    Jul 10 '15 at 21:05














29












29








29


11






Im trying to make a shortcut to login my ssh server:



ssh x.x.x.x


I made the following file:



ssh_home.sh


Made it executable:



sudo chmod +x ./ssh_home


Checked by right clicking properties to check if it was executable and it was..



But whatever I do, when double clicking it, it will launch gedit.
I tried "Open With" but no terminal app is shown there.
I searched the net but only found a way to link to the file while not integrating it in one "shortcut file"










share|improve this question
















Im trying to make a shortcut to login my ssh server:



ssh x.x.x.x


I made the following file:



ssh_home.sh


Made it executable:



sudo chmod +x ./ssh_home


Checked by right clicking properties to check if it was executable and it was..



But whatever I do, when double clicking it, it will launch gedit.
I tried "Open With" but no terminal app is shown there.
I searched the net but only found a way to link to the file while not integrating it in one "shortcut file"







bash shortcuts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 20 '13 at 0:31









kiri

19.1k1259104




19.1k1259104










asked May 23 '13 at 11:48









michelmichel

154124




154124








  • 2





    Did you add #! /usr/bin/sh at the beginning of the file (the first line)?

    – Misery
    May 23 '13 at 11:50













  • Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...)

    – Jez W
    May 23 '13 at 11:59













  • Also check owner and permissions. Does user clicking it have permission to run it?

    – Misery
    May 23 '13 at 12:04






  • 1





    Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files.

    – l0b0
    May 23 '13 at 12:04






  • 1





    @Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>)

    – Keith Thompson
    Jul 10 '15 at 21:05














  • 2





    Did you add #! /usr/bin/sh at the beginning of the file (the first line)?

    – Misery
    May 23 '13 at 11:50













  • Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...)

    – Jez W
    May 23 '13 at 11:59













  • Also check owner and permissions. Does user clicking it have permission to run it?

    – Misery
    May 23 '13 at 12:04






  • 1





    Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files.

    – l0b0
    May 23 '13 at 12:04






  • 1





    @Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>)

    – Keith Thompson
    Jul 10 '15 at 21:05








2




2





Did you add #! /usr/bin/sh at the beginning of the file (the first line)?

– Misery
May 23 '13 at 11:50







Did you add #! /usr/bin/sh at the beginning of the file (the first line)?

– Misery
May 23 '13 at 11:50















Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...)

– Jez W
May 23 '13 at 11:59







Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...)

– Jez W
May 23 '13 at 11:59















Also check owner and permissions. Does user clicking it have permission to run it?

– Misery
May 23 '13 at 12:04





Also check owner and permissions. Does user clicking it have permission to run it?

– Misery
May 23 '13 at 12:04




1




1





Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files.

– l0b0
May 23 '13 at 12:04





Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files.

– l0b0
May 23 '13 at 12:04




1




1





@Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>)

– Keith Thompson
Jul 10 '15 at 21:05





@Misery: It's /bin/sh, not /usr/bin/sh. (/usr/bin/sh will happen to work on systems where /bin and /usr/bin are the same directory; I don't think that's the case for Ubuntu>)

– Keith Thompson
Jul 10 '15 at 21:05










5 Answers
5






active

oldest

votes


















44














I know this is a while ago but though if someone else asks I have this answer.




  1. Open nautilus

  2. Files menu -> behaviour tab

  3. Run executable text files when they are opened


In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab



In Ubuntu 14.10 move the mouse to the top of the screen and the File, Edit etc... Menu bar appears. Click EDIT -> Preferences -> Behaviour tab






share|improve this answer





















  • 2





    This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

    – David Baucum
    Aug 16 '14 at 0:12











  • What is Files menu? Never seen it.

    – IgorGanapolsky
    Mar 29 '15 at 16:27











  • Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

    – maxweber
    Apr 16 '15 at 15:33






  • 3





    One complication is that this affects all executable files. (That might be what you want.)

    – Keith Thompson
    Jul 10 '15 at 21:06













  • Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

    – MS Berends
    Feb 10 at 16:31



















32














I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:



[Desktop Entry]
Version=1.0
Exec=/home/yourname/bin/ssh_home.sh
Name=SSH Server
GenericName=SSH Server
Comment=Connect to My Server
Encoding=UTF-8
Terminal=true
Type=Application
Categories=Application;Network;


That way you will have a clickable icon which will launch your script.



You may have to also set the executable flag with chmod:



chmod +x ~/Desktop/ssh_home.desktop





share|improve this answer





















  • 1





    This method IS working but I prefer a 1 file solution...

    – michel
    May 23 '13 at 14:16






  • 6





    @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

    – geirha
    May 23 '13 at 18:33








  • 1





    This is the only solution that worked for me.

    – Aviad P.
    Aug 26 '15 at 16:50











  • I get Untrusted application launcher message box and it doesn't run my command.

    – Matt
    Dec 27 '18 at 20:00











  • @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

    – Olivia Stork
    Jan 18 at 18:38



















2














The "trap" for me was that I searched via right-clicking on the file for a way to change the behaviour (to have a script run instead of opened in gedit). Don't right-click ! Rather open from the "regular" menu-bar:



Edit-Preferences-Behaviour and change to "run" or "ask each time".



Comment: For my taste there should be a way to run a program via right-clicking too. Especially since right-clicking leads to the menu "open with", which makes you search for "open with bash", however "bash" is not included as an option...






share|improve this answer
























  • For my taste also...

    – Marecky
    May 10 '17 at 16:37



















1














imo the simplest answer is -




  1. Check that the .sh file works if clicked or run from its own directory.

  2. If it works there, right-click on it in Files aka Nautilus, select
    'Make Link'

  3. This produces a file named 'link to xxxx.sh' in the same directory

  4. Drag this onto the desktop

  5. Rename it how you wish eg clean off 'link to' and 'sh', just leave the name,
    it will still work.






share|improve this answer


























  • Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

    – Brian Hellekin
    May 24 '17 at 4:07



















0














I'd say the easiest way to add a shell script to the shortcuts would be to add the .sh file to the home directory. Once copied to the home directory just go to custom shortcuts and add the command sh yourfile.sh



This was my work around hope it helps you






share|improve this answer






















    protected by Community Feb 2 '18 at 16:52



    Thank you for your interest in this question.
    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



    Would you like to answer one of these unanswered questions instead?














    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    44














    I know this is a while ago but though if someone else asks I have this answer.




    1. Open nautilus

    2. Files menu -> behaviour tab

    3. Run executable text files when they are opened


    In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab



    In Ubuntu 14.10 move the mouse to the top of the screen and the File, Edit etc... Menu bar appears. Click EDIT -> Preferences -> Behaviour tab






    share|improve this answer





















    • 2





      This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

      – David Baucum
      Aug 16 '14 at 0:12











    • What is Files menu? Never seen it.

      – IgorGanapolsky
      Mar 29 '15 at 16:27











    • Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

      – maxweber
      Apr 16 '15 at 15:33






    • 3





      One complication is that this affects all executable files. (That might be what you want.)

      – Keith Thompson
      Jul 10 '15 at 21:06













    • Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

      – MS Berends
      Feb 10 at 16:31
















    44














    I know this is a while ago but though if someone else asks I have this answer.




    1. Open nautilus

    2. Files menu -> behaviour tab

    3. Run executable text files when they are opened


    In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab



    In Ubuntu 14.10 move the mouse to the top of the screen and the File, Edit etc... Menu bar appears. Click EDIT -> Preferences -> Behaviour tab






    share|improve this answer





















    • 2





      This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

      – David Baucum
      Aug 16 '14 at 0:12











    • What is Files menu? Never seen it.

      – IgorGanapolsky
      Mar 29 '15 at 16:27











    • Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

      – maxweber
      Apr 16 '15 at 15:33






    • 3





      One complication is that this affects all executable files. (That might be what you want.)

      – Keith Thompson
      Jul 10 '15 at 21:06













    • Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

      – MS Berends
      Feb 10 at 16:31














    44












    44








    44







    I know this is a while ago but though if someone else asks I have this answer.




    1. Open nautilus

    2. Files menu -> behaviour tab

    3. Run executable text files when they are opened


    In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab



    In Ubuntu 14.10 move the mouse to the top of the screen and the File, Edit etc... Menu bar appears. Click EDIT -> Preferences -> Behaviour tab






    share|improve this answer















    I know this is a while ago but though if someone else asks I have this answer.




    1. Open nautilus

    2. Files menu -> behaviour tab

    3. Run executable text files when they are opened


    In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab



    In Ubuntu 14.10 move the mouse to the top of the screen and the File, Edit etc... Menu bar appears. Click EDIT -> Preferences -> Behaviour tab







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 2 '16 at 14:47









    muru

    1




    1










    answered Sep 20 '13 at 0:26









    PeterPeter

    56946




    56946








    • 2





      This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

      – David Baucum
      Aug 16 '14 at 0:12











    • What is Files menu? Never seen it.

      – IgorGanapolsky
      Mar 29 '15 at 16:27











    • Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

      – maxweber
      Apr 16 '15 at 15:33






    • 3





      One complication is that this affects all executable files. (That might be what you want.)

      – Keith Thompson
      Jul 10 '15 at 21:06













    • Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

      – MS Berends
      Feb 10 at 16:31














    • 2





      This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

      – David Baucum
      Aug 16 '14 at 0:12











    • What is Files menu? Never seen it.

      – IgorGanapolsky
      Mar 29 '15 at 16:27











    • Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

      – maxweber
      Apr 16 '15 at 15:33






    • 3





      One complication is that this affects all executable files. (That might be what you want.)

      – Keith Thompson
      Jul 10 '15 at 21:06













    • Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

      – MS Berends
      Feb 10 at 16:31








    2




    2





    This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

    – David Baucum
    Aug 16 '14 at 0:12





    This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus.

    – David Baucum
    Aug 16 '14 at 0:12













    What is Files menu? Never seen it.

    – IgorGanapolsky
    Mar 29 '15 at 16:27





    What is Files menu? Never seen it.

    – IgorGanapolsky
    Mar 29 '15 at 16:27













    Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

    – maxweber
    Apr 16 '15 at 15:33





    Worked. Right click on my shell script in the file browser. Created link. Then drag and dropped link to desktop. Also did the step above in file browse -> Preferences->run instead of view.

    – maxweber
    Apr 16 '15 at 15:33




    3




    3





    One complication is that this affects all executable files. (That might be what you want.)

    – Keith Thompson
    Jul 10 '15 at 21:06







    One complication is that this affects all executable files. (That might be what you want.)

    – Keith Thompson
    Jul 10 '15 at 21:06















    Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

    – MS Berends
    Feb 10 at 16:31





    Great answer! On Ubuntu 18.04, I set it to 'Ask what to do', so I can choose to run or display it every time I double click such a file. Thanks!

    – MS Berends
    Feb 10 at 16:31













    32














    I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:



    [Desktop Entry]
    Version=1.0
    Exec=/home/yourname/bin/ssh_home.sh
    Name=SSH Server
    GenericName=SSH Server
    Comment=Connect to My Server
    Encoding=UTF-8
    Terminal=true
    Type=Application
    Categories=Application;Network;


    That way you will have a clickable icon which will launch your script.



    You may have to also set the executable flag with chmod:



    chmod +x ~/Desktop/ssh_home.desktop





    share|improve this answer





















    • 1





      This method IS working but I prefer a 1 file solution...

      – michel
      May 23 '13 at 14:16






    • 6





      @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

      – geirha
      May 23 '13 at 18:33








    • 1





      This is the only solution that worked for me.

      – Aviad P.
      Aug 26 '15 at 16:50











    • I get Untrusted application launcher message box and it doesn't run my command.

      – Matt
      Dec 27 '18 at 20:00











    • @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

      – Olivia Stork
      Jan 18 at 18:38
















    32














    I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:



    [Desktop Entry]
    Version=1.0
    Exec=/home/yourname/bin/ssh_home.sh
    Name=SSH Server
    GenericName=SSH Server
    Comment=Connect to My Server
    Encoding=UTF-8
    Terminal=true
    Type=Application
    Categories=Application;Network;


    That way you will have a clickable icon which will launch your script.



    You may have to also set the executable flag with chmod:



    chmod +x ~/Desktop/ssh_home.desktop





    share|improve this answer





















    • 1





      This method IS working but I prefer a 1 file solution...

      – michel
      May 23 '13 at 14:16






    • 6





      @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

      – geirha
      May 23 '13 at 18:33








    • 1





      This is the only solution that worked for me.

      – Aviad P.
      Aug 26 '15 at 16:50











    • I get Untrusted application launcher message box and it doesn't run my command.

      – Matt
      Dec 27 '18 at 20:00











    • @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

      – Olivia Stork
      Jan 18 at 18:38














    32












    32








    32







    I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:



    [Desktop Entry]
    Version=1.0
    Exec=/home/yourname/bin/ssh_home.sh
    Name=SSH Server
    GenericName=SSH Server
    Comment=Connect to My Server
    Encoding=UTF-8
    Terminal=true
    Type=Application
    Categories=Application;Network;


    That way you will have a clickable icon which will launch your script.



    You may have to also set the executable flag with chmod:



    chmod +x ~/Desktop/ssh_home.desktop





    share|improve this answer















    I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:



    [Desktop Entry]
    Version=1.0
    Exec=/home/yourname/bin/ssh_home.sh
    Name=SSH Server
    GenericName=SSH Server
    Comment=Connect to My Server
    Encoding=UTF-8
    Terminal=true
    Type=Application
    Categories=Application;Network;


    That way you will have a clickable icon which will launch your script.



    You may have to also set the executable flag with chmod:



    chmod +x ~/Desktop/ssh_home.desktop






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 18 at 22:09









    Olivia Stork

    1054




    1054










    answered May 23 '13 at 12:51









    Cyril LauryCyril Laury

    62645




    62645








    • 1





      This method IS working but I prefer a 1 file solution...

      – michel
      May 23 '13 at 14:16






    • 6





      @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

      – geirha
      May 23 '13 at 18:33








    • 1





      This is the only solution that worked for me.

      – Aviad P.
      Aug 26 '15 at 16:50











    • I get Untrusted application launcher message box and it doesn't run my command.

      – Matt
      Dec 27 '18 at 20:00











    • @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

      – Olivia Stork
      Jan 18 at 18:38














    • 1





      This method IS working but I prefer a 1 file solution...

      – michel
      May 23 '13 at 14:16






    • 6





      @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

      – geirha
      May 23 '13 at 18:33








    • 1





      This is the only solution that worked for me.

      – Aviad P.
      Aug 26 '15 at 16:50











    • I get Untrusted application launcher message box and it doesn't run my command.

      – Matt
      Dec 27 '18 at 20:00











    • @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

      – Olivia Stork
      Jan 18 at 18:38








    1




    1





    This method IS working but I prefer a 1 file solution...

    – michel
    May 23 '13 at 14:16





    This method IS working but I prefer a 1 file solution...

    – michel
    May 23 '13 at 14:16




    6




    6





    @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

    – geirha
    May 23 '13 at 18:33







    @michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host.

    – geirha
    May 23 '13 at 18:33






    1




    1





    This is the only solution that worked for me.

    – Aviad P.
    Aug 26 '15 at 16:50





    This is the only solution that worked for me.

    – Aviad P.
    Aug 26 '15 at 16:50













    I get Untrusted application launcher message box and it doesn't run my command.

    – Matt
    Dec 27 '18 at 20:00





    I get Untrusted application launcher message box and it doesn't run my command.

    – Matt
    Dec 27 '18 at 20:00













    @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

    – Olivia Stork
    Jan 18 at 18:38





    @Matt try right clicking on the icon, go to Properties > Permissions then select Allow executing file as program. Also if you copy and pasted the text above into your file, make sure there isnt any trailing whitespace after the lines. That may cause your error message.

    – Olivia Stork
    Jan 18 at 18:38











    2














    The "trap" for me was that I searched via right-clicking on the file for a way to change the behaviour (to have a script run instead of opened in gedit). Don't right-click ! Rather open from the "regular" menu-bar:



    Edit-Preferences-Behaviour and change to "run" or "ask each time".



    Comment: For my taste there should be a way to run a program via right-clicking too. Especially since right-clicking leads to the menu "open with", which makes you search for "open with bash", however "bash" is not included as an option...






    share|improve this answer
























    • For my taste also...

      – Marecky
      May 10 '17 at 16:37
















    2














    The "trap" for me was that I searched via right-clicking on the file for a way to change the behaviour (to have a script run instead of opened in gedit). Don't right-click ! Rather open from the "regular" menu-bar:



    Edit-Preferences-Behaviour and change to "run" or "ask each time".



    Comment: For my taste there should be a way to run a program via right-clicking too. Especially since right-clicking leads to the menu "open with", which makes you search for "open with bash", however "bash" is not included as an option...






    share|improve this answer
























    • For my taste also...

      – Marecky
      May 10 '17 at 16:37














    2












    2








    2







    The "trap" for me was that I searched via right-clicking on the file for a way to change the behaviour (to have a script run instead of opened in gedit). Don't right-click ! Rather open from the "regular" menu-bar:



    Edit-Preferences-Behaviour and change to "run" or "ask each time".



    Comment: For my taste there should be a way to run a program via right-clicking too. Especially since right-clicking leads to the menu "open with", which makes you search for "open with bash", however "bash" is not included as an option...






    share|improve this answer













    The "trap" for me was that I searched via right-clicking on the file for a way to change the behaviour (to have a script run instead of opened in gedit). Don't right-click ! Rather open from the "regular" menu-bar:



    Edit-Preferences-Behaviour and change to "run" or "ask each time".



    Comment: For my taste there should be a way to run a program via right-clicking too. Especially since right-clicking leads to the menu "open with", which makes you search for "open with bash", however "bash" is not included as an option...







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 7 '15 at 3:29









    patrick pirkerpatrick pirker

    211




    211













    • For my taste also...

      – Marecky
      May 10 '17 at 16:37



















    • For my taste also...

      – Marecky
      May 10 '17 at 16:37

















    For my taste also...

    – Marecky
    May 10 '17 at 16:37





    For my taste also...

    – Marecky
    May 10 '17 at 16:37











    1














    imo the simplest answer is -




    1. Check that the .sh file works if clicked or run from its own directory.

    2. If it works there, right-click on it in Files aka Nautilus, select
      'Make Link'

    3. This produces a file named 'link to xxxx.sh' in the same directory

    4. Drag this onto the desktop

    5. Rename it how you wish eg clean off 'link to' and 'sh', just leave the name,
      it will still work.






    share|improve this answer


























    • Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

      – Brian Hellekin
      May 24 '17 at 4:07
















    1














    imo the simplest answer is -




    1. Check that the .sh file works if clicked or run from its own directory.

    2. If it works there, right-click on it in Files aka Nautilus, select
      'Make Link'

    3. This produces a file named 'link to xxxx.sh' in the same directory

    4. Drag this onto the desktop

    5. Rename it how you wish eg clean off 'link to' and 'sh', just leave the name,
      it will still work.






    share|improve this answer


























    • Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

      – Brian Hellekin
      May 24 '17 at 4:07














    1












    1








    1







    imo the simplest answer is -




    1. Check that the .sh file works if clicked or run from its own directory.

    2. If it works there, right-click on it in Files aka Nautilus, select
      'Make Link'

    3. This produces a file named 'link to xxxx.sh' in the same directory

    4. Drag this onto the desktop

    5. Rename it how you wish eg clean off 'link to' and 'sh', just leave the name,
      it will still work.






    share|improve this answer















    imo the simplest answer is -




    1. Check that the .sh file works if clicked or run from its own directory.

    2. If it works there, right-click on it in Files aka Nautilus, select
      'Make Link'

    3. This produces a file named 'link to xxxx.sh' in the same directory

    4. Drag this onto the desktop

    5. Rename it how you wish eg clean off 'link to' and 'sh', just leave the name,
      it will still work.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '16 at 6:36









    muru

    1




    1










    answered Apr 13 '16 at 6:35









    Martin ClarkMartin Clark

    111




    111













    • Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

      – Brian Hellekin
      May 24 '17 at 4:07



















    • Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

      – Brian Hellekin
      May 24 '17 at 4:07

















    Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

    – Brian Hellekin
    May 24 '17 at 4:07





    Also you can change the icon of the link too. Right-click it, select Properties, click the default icon in the upper left part of the properties window, and so just navigate until you find the image your want to be the icon.

    – Brian Hellekin
    May 24 '17 at 4:07











    0














    I'd say the easiest way to add a shell script to the shortcuts would be to add the .sh file to the home directory. Once copied to the home directory just go to custom shortcuts and add the command sh yourfile.sh



    This was my work around hope it helps you






    share|improve this answer




























      0














      I'd say the easiest way to add a shell script to the shortcuts would be to add the .sh file to the home directory. Once copied to the home directory just go to custom shortcuts and add the command sh yourfile.sh



      This was my work around hope it helps you






      share|improve this answer


























        0












        0








        0







        I'd say the easiest way to add a shell script to the shortcuts would be to add the .sh file to the home directory. Once copied to the home directory just go to custom shortcuts and add the command sh yourfile.sh



        This was my work around hope it helps you






        share|improve this answer













        I'd say the easiest way to add a shell script to the shortcuts would be to add the .sh file to the home directory. Once copied to the home directory just go to custom shortcuts and add the command sh yourfile.sh



        This was my work around hope it helps you







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 25 '16 at 1:53









        Markovitz HernandezMarkovitz Hernandez

        1




        1

















            protected by Community Feb 2 '18 at 16:52



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?



            Popular posts from this blog

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅