Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to run a sh file by clicking it?

  1. #1
    Join Date
    Dec 2010
    Beans
    9

    How to run a sh file by clicking it?

    hi there,

    I have already put chmod 777 and chmod +x on it but it still opens to gedit and doesnt run.

    Can anyone tell me what to do.

    My sh file:

    Code:
    #!/bin/bash
    #Open reaper program
    
    cd "/home/developer/reaper/.wine/drive_c/Program Files (x86)/REAPER"
    
    ./reaper.exe

  2. #2
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,765

    Re: How to run a sh file by clicking it?

    You have a Windows program, and the command to run it requires wine. Something similar to:

    wine "c:\program files\cribbage\CRIB.EXE"

    which is an example from my machine. Use quotes around the path if there are spaces in it.
    Last edited by Dennis N; September 18th, 2013 at 03:21 AM.

  3. #3
    Join Date
    Dec 2010
    Beans
    9

    Re: How to run a sh file by clicking it?

    Quote Originally Posted by Dennis N View Post
    You have a Windows program, and the command to run it requires wine. Something similar to:

    wine "c:\program files\cribbage\CRIB.EXE"

    which is an example from my machine. Use quotes around the path if there are spaces in it.
    yeah either script works the same. Even using your method, my sh file still opens to gedit and doesnt run the program.

  4. #4
    Join Date
    Sep 2008
    Location
    Chicago
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to run a sh file by clicking it?

    Yes, the line would have to start with wine. The double-click issue is solved by:

    Right clicking on the file in Nautilus
    Open With
    Open With other application
    Use a custom command
    Browse
    Select "gnome-terminal" in /usr/bin/
    Add
    Close

    That should do it. This is from memory and an earlier Ubuntu version.
    Last edited by whitesmith; September 18th, 2013 at 03:36 AM.
    In working with *nix...There be dragons. Newcomers: I recommend reading Linux is Not Windows (http://linux.oneandoneis2.org/LNW.htm) and The Linux Command Line (http://www.linuxcommand.org/tlcl.php) before beginning your quest for a better OS.

  5. #5
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,765

    Re: How to run a sh file by clicking it?

    Your command ./reaper.exe will only work for a Linux program which this is not. The command itself must start wine, which in turn loads the Windows program from somewhere in its C:\ directory. The C:\ directory is mapped to ~/.wine/drive_c on your Linux system. Also be sure to use \ and not / in the Windows path.

  6. #6
    Join Date
    Dec 2010
    Beans
    9

    Re: How to run a sh file by clicking it?

    Quote Originally Posted by whitesmith View Post
    Yes, the line would have to start with wine. The double-click issue is solved by:

    Right clicking on the file in Nautilus
    Open With
    Open With other application
    Use a custom command
    Browse
    Select "gnome-terminal" in /usr/bin/
    Add
    Close

    That should do it. This is from memory and an earlier Ubuntu version.
    Hi there,

    I followed what you said but i can't find the the use custom command option. I've got related applications, other application, find applications online. (Using ubuntu 13.04)

  7. #7
    Join Date
    Sep 2008
    Location
    Chicago
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to run a sh file by clicking it?

    I think my instructions go too far back. Try this. Make a directory called /home/bin. All executables (including scripts) really belong there, anyway. Now get /home/bin into your path. Put your script there. Logout and back in. This procedure should work on any version.
    In working with *nix...There be dragons. Newcomers: I recommend reading Linux is Not Windows (http://linux.oneandoneis2.org/LNW.htm) and The Linux Command Line (http://www.linuxcommand.org/tlcl.php) before beginning your quest for a better OS.

  8. #8
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,765

    Re: How to run a sh file by clicking it?

    The path probably should be /home/<username>/bin
    Last edited by Dennis N; September 18th, 2013 at 04:35 AM. Reason: error

  9. #9
    Join Date
    Oct 2008
    Beans
    3,509

    Re: How to run a sh file by clicking it?

    Do other scripts run when clicked?
    Have you set the executable text file behaviour in nautilus preferences?
    Clicking in the dash will always open in gedit no matter the nautilus setting.
    You would need to create a .desktop file for the dash.
    Last edited by stinkeye; September 18th, 2013 at 04:57 AM.

  10. #10
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,765

    Re: How to run a sh file by clicking it?

    Quote Originally Posted by hamiltino View Post
    yeah either script works the same. Even using your method, my sh file still opens to gedit and doesnt run the program.
    You should post your command (using wine) so we can have a look at it and maybe see why it fails.

    But,

    You really don't need a script or even the terminal to start Windows programs installed by Wine. In Ubuntu, you can search for the Windows program name in the Dash and click on it. The Wine desktop will open with your program. In Xubuntu or Lubuntu, Wine with all programs you installed with Wine can be accessed from the main menu under the Wine category.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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