<---- template headericclude ----->
shell script
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 14 of 14
  1. #1
    Wangberg Guest

    shell script

    i got my first shell script working something very simple, but will still save a few commands. I'm really excited about shell scripting

    i'm trying to execute a shell script when i double click on it via GUI. i'm not sure how to do this!

    any help would be much appreciated!

  2. #2
    Join Date
    Dec 2004
    Location
    Dallas, Texas
    Age
    52
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    chmod a + x /path/to/file
    in the terminal or right click the script file in the GUI and look for the permissions tab. Check on the "Execute" item and it should allow you to double-click and run it.
    You can call me Bill
    Registered Linux user: 435641
    1 F?? workstation, 1 XBMC PVR and two Win7 workstations.
    Too many other pc's - some that are even still running.

  3. #3
    Wangberg Guest
    wdgiles,

    i tried that and it still wont execute with double click.

  4. #4
    Join Date
    Nov 2006
    Location
    Detroit
    Posts
    8,750
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    How do you know that it isn't executing?

  5. #5
    Wangberg Guest
    because when i double click on it nothing happens, and when i do a 'ps' there is no listing for the app that should have been executed by the script.

  6. #6
    jim's Avatar
    jim is offline Retired Community Manager & Avid Drinker Of Suds
    Join Date
    Feb 2005
    Location
    Rochester NY
    Age
    49
    Posts
    4,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    open a terminal

    cd to the script directory
    type
    ll
    (thats 2 L's)
    what are the permissions ?
    -rwxr-xr-x
    Registered Linux User: #376813
    Western NY
    My linux site
    Smolt Profile

    please remember to say if you problem was solved

    Did you get your id10t award today?

  7. #7
    Wangberg Guest
    The script is called tagger

    Code:
    [root@localhost Desktop]# ll
    total 13380
    drwxr-xr-x  2 mike mike     4096 Mar 26 01:10 CentOS-4.4-i386-LiveCD
    drwxrwxr-x  2 mike mike     4096 Mar 22 19:13 laptop
    drwxrwxr-x 29 mike mike     4096 Feb 23 22:48 My Documents
    drwxrwxr-x  4 mike mike     4096 Feb 27 17:24 ndis
    -rwxrwxrwx  1 mike mike 13032175 Jan 18 14:47 NVIDIA-Linux-x86-1.0-8762-pkg1.run
    drwxrwxr-x  4 mike mike     4096 May  7  2005 pyslsk-1.2.7b
    -rw-rw-r--  1 mike mike   600855 Mar 26 01:00 quadkonsole-2.0.1.tar.gz
    -rwxrwxr-x  1 mike mike       81 Mar 26 03:56 tagger
    -rw-r--r--  1 mike mike     5066 Feb 11 10:45 trash.desktop
    [root@localhost Desktop]#

  8. #8
    jim's Avatar
    jim is offline Retired Community Manager & Avid Drinker Of Suds
    Join Date
    Feb 2005
    Location
    Rochester NY
    Age
    49
    Posts
    4,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    type

    chmod 755 tagger
    Registered Linux User: #376813
    Western NY
    My linux site
    Smolt Profile

    please remember to say if you problem was solved

    Did you get your id10t award today?

  9. #9
    Wangberg Guest
    maybe it's my script....because the 755 permissions didn't help.

    i was under the impression all i have to do is create a file with shell commands on each line...here is what i have:

    Code:
    #!/bin/bash
    
    su -
    wine /root/.wine/drive_c/Program\ Files//Mp3tag/Mp3tag.exe
    exit

  10. #10
    Join Date
    Mar 2007
    Location
    Nepal
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi
    i have also been working with shell scripts
    but i don't know exactly how to make it run by double click

    however you could just run your script using terminal

    $sh tagger(your filename)

    it will run

    and by the way if you come to know how to make them work just by double click please post in the forum
    i was also searching for that
    thanks

  11. #11
    Wangberg Guest
    shreedhan,

    using the 'sh' command worked, but wasn't 100% perfect.

    after i type 'sh tagger', it drops down to a fresh commandline and i need to type 'exit' before the script actually runs....hence the "exit' at the end of my script.

    any help in double-clicking or how to make this execute without having to manually do anything would be the best help!

    i'll def. keep you posted!

  12. #12
    Join Date
    Nov 2006
    Location
    Detroit
    Posts
    8,750
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    OK, now that you've shown the contents of your script I can see why it doesn't even run. When you run "su -" that opens a subshell from within the script. That subshell will run (as root) until you exit from it, then the rest of the script will run. If you are just trying to run that wine command as root, then you need to use the -c option to su:
    Code:
    #!/bin/bash
    su - -c "wine /root/.wine/drive_c/Program\ Files//Mp3tag/Mp3tag.exe"
    Because of the space in "Program Files" you may have to fiddle with that wine command to get it to run right.

    By the way, is there a password for root? I sure hope so! And if there is, then double-clicking the script in a GUI won't work, because you'll need to interact with the script to enter the password, which probably won't happen unless you run the script from a terminal.

  13. #13
    Join Date
    Jan 2006
    Location
    Denver, CO USA
    Posts
    670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's your problem: you are trying to su - from a gui. su prompts for a password, but there is no way to enter it. so the su - fails. then when you get to the wine part, since you are not root, it does not run. The solution is to set yourself up is sudoers and run the wine command with sudo.

    davidj

  14. #14
    Join Date
    Mar 2005
    Location
    Mobile, Alabama, USA
    Age
    46
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might be able to do this with a program called zenity. I don't know exactly how you would use it, or if it would even work, but it's worth a shot. I used it on the Repoman script to create a GUI. Search the forum for repoman if you want to see how I used it.

Similar Threads

  1. call remote shell script within an expect script
    By PhillyFloyd in forum Programming & Packaging
    Replies: 2
    Last Post: 16th October 2007, 10:29 PM
  2. starting a shell script inside a php script
    By gw348 in forum Using Fedora
    Replies: 6
    Last Post: 23rd April 2007, 09:30 PM
  3. Shell Script
    By remm692007 in forum Programming & Packaging
    Replies: 2
    Last Post: 13th April 2007, 06:32 PM
  4. need to run script Bourne-shell script
    By armen in forum Using Fedora
    Replies: 4
    Last Post: 4th April 2005, 01:16 PM
  5. Shell script
    By ieuuk in forum Programming & Packaging
    Replies: 5
    Last Post: 28th October 2004, 10:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
[[template footer(Guest)]]