Fedora Linux Support Community & Resources Center
  #1  
Old 26th March 2007, 09:03 AM
Wangberg Offline
Registered User
 
Join Date: Dec 2006
Location: PRC
Posts: 427
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!
__________________
focus on everything...
Get Swiftfox
registered linux user #438335
Reply With Quote
  #2  
Old 26th March 2007, 04:40 PM
wdgiles Offline
Still Nothing
 
Join Date: Dec 2004
Location: Dallas, Texas
Age: 42
Posts: 684
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.
Reply With Quote
  #3  
Old 26th March 2007, 05:14 PM
Wangberg Offline
Registered User
 
Join Date: Dec 2006
Location: PRC
Posts: 427
wdgiles,

i tried that and it still wont execute with double click.
__________________
focus on everything...
Get Swiftfox
registered linux user #438335
Reply With Quote
  #4  
Old 26th March 2007, 05:37 PM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,599
How do you know that it isn't executing?
Reply With Quote
  #5  
Old 26th March 2007, 10:47 PM
Wangberg Offline
Registered User
 
Join Date: Dec 2006
Location: PRC
Posts: 427
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.
__________________
focus on everything...
Get Swiftfox
registered linux user #438335
Reply With Quote
  #6  
Old 26th March 2007, 11:15 PM
jim Offline
Retired Community Manager & Avid Drinker Of Suds
 
Join Date: Feb 2005
Location: Rochester NY
Age: 39
Posts: 4,175
open a terminal

cd to the script directory
type
Quote:
ll
(thats 2 L's)
what are the permissions ?
Quote:
-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?
Reply With Quote
  #7  
Old 26th March 2007, 11:28 PM
Wangberg Offline
Registered User
 
Join Date: Dec 2006
Location: PRC
Posts: 427
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]#
__________________
focus on everything...
Get Swiftfox
registered linux user #438335
Reply With Quote
  #8  
Old 27th March 2007, 12:01 AM
jim Offline
Retired Community Manager & Avid Drinker Of Suds
 
Join Date: Feb 2005
Location: Rochester NY
Age: 39
Posts: 4,175
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?
Reply With Quote
  #9  
Old 27th March 2007, 02:50 AM
Wangberg Offline
Registered User
 
Join Date: Dec 2006
Location: PRC
Posts: 427
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
__________________
focus on everything...
Get Swiftfox
registered linux user #438335
Reply With Quote
  #10  
Old 27th March 2007, 03:19 AM
shreedhan Offline
Registered User
 
Join Date: Mar 2007
Location: Nepal
Posts: 86
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
Reply With Quote
  #11  
Old 27th March 2007, 03:25 AM
Wangberg Offline
Registered User
 
Join Date: Dec 2006
Location: PRC
Posts: 427
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!
__________________
focus on everything...
Get Swiftfox
registered linux user #438335
Reply With Quote
  #12  
Old 27th March 2007, 07:40 AM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,599
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.
Reply With Quote
  #13  
Old 27th March 2007, 08:00 AM
daverj Offline
Registered User
 
Join Date: Jan 2006
Location: Denver, CO USA
Posts: 670
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
Reply With Quote
  #14  
Old 4th April 2007, 04:48 PM
The_Jaymz Offline
Registered User
 
Join Date: Mar 2005
Location: Mobile, Alabama, USA
Age: 36
Posts: 342
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.
Reply With Quote
Reply

Tags
script, shell

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


Current GMT-time: 19:21 (Thursday, 24-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat