http://askubuntu.com/questions/465531/how-to-make-a-shell-file-execute-by-double-click

To run your script by double clicking on its icon, you will need to create a .desktop file for it:

[Desktop Entry]
Name=My script
Comment=Test hello world script
Exec=/home/user/yourscript.sh
Icon=/home/user/youricon.gif
Terminal=false
Type=Application

Save the above as a file on your Desktop with a .desktop extension. Change /home/user/yourscript.sh and /home/user/youricon.gif to the paths of your script and whichever icon you want it ot have respectively and then you'll be able to launch by double clicking it.


Specifically, for your situation, you need to do:

  1. Create a script that runs mono LOIC.exe. To do so, create a new text file with these contents:

    #!/bin/bash
    mono /home/logan/.loic/LOIC.exe

    Save this as /home/locan/run_loic.sh and then run this command to make it executable (or right click => properties and choose "Allow executing file as program"):

    chmod +x /home/logan/.loic/LOIC.exe
  2. Create a .desktop file that launches that script. Create a new text file on your Desktop called run_loic.desktop with these contents:

    [Desktop Entry]
    Name=Run LOIC
    Comment=Run LOIC
    Exec=/home/logan/run_loic.sh
    Icon=
    Terminal=false
    Type=Application

http://forum.ubuntu.org.cn/viewtopic.php?p=1861292

Thread: Opening .sh files with double click?

 
  • Thread Tools
  1. August 28th, 2014#1

    5 Cups of Ubuntu

     
    Join Date
    Aug 2014
    Beans
    20

    Opening .sh files with double click?

    I just install PyCharm on ubuntu 14 and by default when i double click it opens the .sh file with gedit. How could I make it to just run the program when i double click?

  2. August 28th, 2014#2

    Caffeine Fueled

     
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Opening .sh files with double click?

    To run executable files from Nautilus (Files) go to the Edit menu and select Preferences->Behaviour, and under Executable Text Files select Ask each time

  3. August 28th, 2014#3

    Tall Cafè Ubuntu

     
    Join Date
    May 2009
    Location
    Fareham, UK
    Beans
    Hidden!
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Opening .sh files with double click?

    Of course this only works if your script IS executable, check in the files properties.

    Catch me on Freenode - imark
 

最新文章

  1. PHP函数、数组
  2. 6、后记:PMO项目管理 - PMO项目管理办公室
  3. Codeforces Round #192 (Div. 2)
  4. iOS开发多线程篇—创建线程
  5. oracle SQLserver 函数
  6. GC的代机制
  7. oracle删除表的方法
  8. Spark计算模型
  9. Gvim安装nerd_tree插件
  10. 巡风源码阅读与分析---view.py
  11. [SCOI2006] 数字立方体
  12. # 20175329 2018-2019-2 《Java程序设计》第一周学习总结
  13. Linux vmstat命令
  14. flask项目第一次如何运行创建数据库
  15. python 的基础 学习 第五天 基础数据类型的操作方法
  16. Docker命令使用详解(转)
  17. Android 反编译apk
  18. 举个通俗易懂的例子告诉你IAAS,SAAS,PAAS的区别
  19. RxJava【创建】操作符 create just from defer timer interval MD
  20. 【bzoj2002】 Hnoi2010—Bounce 弹飞绵羊

热门文章

  1. MATLAB学习笔记(八)——MATLAB数值积分与微分
  2. SQLServer备份脚本
  3. Ajax介绍
  4. CodeForces 300C 最短路
  5. SPOJ287 Smart Network Administrator(最大流)
  6. 基于Extjs的web表单设计器 第四节——控件拖放
  7. 分布式流式处理框架:storm简介 + Storm术语解释
  8. iOS移动开发周报-第22期
  9. ThinkPHP添加模板时,犯的三个错
  10. Html - 仿QQ空间右下角工具浮动块