Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11th October 2006, 01:19 PM
radocool's Avatar
radocool Offline
Registered User
 
Join Date: Oct 2006
Posts: 3
Shell Script writing

Hello all,
I am trying to make my Starcraft work via a shell script.I have an iso image of the expansion Brood War and i want to do the following:
1. Mount the broodwar iso image to, let's say, /media/iso
2.Starting the game with wine
3.After exiting starcraft, unmount the broodwar image

My script looks like this;
#!/bin/bash
# My Starcraft Script
cd /home/user/Starcraft
sudo -p xxxxxxxxx mount -o loop broodwar.iso /media/iso
wine /home/user/games/Starcraft/starcraft.exe

My particular problem is the implementation of th third step.If someone knows how to do it, please help me, because I'm still new to shell scripting.
With kind regards,
Rado

Last edited by radocool; 11th October 2006 at 01:23 PM.
Reply With Quote
  #2  
Old 11th October 2006, 05:59 PM
huw-l Offline
Registered User
 
Join Date: Apr 2004
Location: Cardiff, UK
Age: 35
Posts: 315
Code:
#!/bin/bash
# My Starcraft Script
cd /home/user/Starcraft
sudo -p xxxxxxxxx mount -o loop broodwar.iso /media/iso
wine /home/user/games/Starcraft/starcraft.exe
sudo -p xxxxxxxxx umount /media/iso
the script will sit there waiting for starcraft to exit. When it does the script will go onto the next step and unmount the CD
Reply With Quote
  #3  
Old 11th October 2006, 07:53 PM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,298
huw-l is correct, but if I may suggest an additional improvement.

As root enter the following new line into /etc/fstab
/home/user/Starcraft/broodwar.iso /mnt/iso loop,user 0 0

This line permits any user to mount and unmount the iso image as a loop device at the mountpoint /mnt/iso. (Note - that user may need access permission on the .mnt/iso directory and to the iso image). So then your sudo -p ... portions of the command go away and your script lools like ....

#!/bin/bash
# My Starcraft Script
cd /home/user/Starcraft
mount broodwar.iso
wine /home/user/games/Starcraft/starcraft.exe
umount broodwar.iso
Reply With Quote
  #4  
Old 11th October 2006, 08:52 PM
d_GeNeRiT Offline
Registered User
 
Join Date: Jan 2006
Posts: 188
Can you point me to a good page that tells the basics for creating scripts?
Reply With Quote
  #5  
Old 11th October 2006, 10:00 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
http://www.tldp.org/LDP/abs/html/
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #6  
Old 11th October 2006, 10:34 PM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,298
Firewing1 has a link to a very nice document.

If you want to see examples of shell scripts, look in (or grep through) /etc/init.d/*
These are the system services startup scripts and there are examples of almost every feature and quoting style for scripts. Some are very simple - others quite complex.
Reply With Quote
  #7  
Old 11th October 2006, 10:57 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Also, if you want to start scripting, a nice way to start is to make Nautilus scripts. Google it for more info, you'll see how they work.
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #8  
Old 11th December 2006, 12:18 PM
radocool's Avatar
radocool Offline
Registered User
 
Join Date: Oct 2006
Posts: 3
Thank you all, for the help
Reply With Quote
Reply

Tags
script, shell, writing

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
Help writing shell script. Tim M Using Fedora 7 23rd September 2007 05:16 PM
starting a shell script inside a php script gw348 Using Fedora 6 23rd April 2007 09:30 PM
Writing a script... six-eleven Using Fedora 3 23rd September 2006 03:40 AM
need to run script Bourne-shell script armen Using Fedora 4 4th April 2005 01:16 PM


Current GMT-time: 07:21 (Sunday, 19-05-2013)

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