LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-09-2003, 12:56 AM   #1
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Rep: Reputation: 15
script


On my desk top are a couple of icons. One is for reading the contents of the floppy drive while the other does the cdrom drive. Well, it mounts them nicely yet it does not unmount them. How would one write a script which when invoked would unmount the cdrom or the floppy?
PS~ I plan on creating a link to these files on the desktop.

My idea is that I would open my favorite editor (jpico) and:

# file to unmount (floppy/cdrom)
umount /mnt/floppy
end

Unfortunately, that is to simple to be right. What is the right method?
 
Old 08-09-2003, 01:10 AM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
actually am i not correct when i say you can right click the icon on your desktop and go to "eject" or "unmount" or whatever it says??
i dont' know what distro your using so this may not be the case in your scenerio.

or you can just write an alias in your .bashrc file and if you are actually not up for typing umount /mnt/floppy then you can add something like this to your .bashrc :
alias uf='umount /mnt/floppy'

where when you type "uf" in the terminal it will unmount it

or you can just open up a blank file with pico or whatever your using and just type:
umount /mnt/floppy
and then :
chmod 777 filename
and then just run :
./filename
whenever you want to unmount and you can also create a desktop link to that file

so theres a couple of options for ya
 
Old 08-09-2003, 01:57 AM   #3
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
Howdy Doc! Well, since posting my original question I have learned that I was wrong; the desktop shortcuts do not mount the floppy or cdrom. So i modified your instructions to say:
#mountfloppy
mount /mnt/floppy
Unfortunately it did not work. Infact, the icon for the file shows it to be merely a text file. So what do I do now?
 
Old 08-09-2003, 02:55 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
set the file to be executable via chmod and add a line at the top saying [code]#!/bin/bash{/code]
 
Old 08-09-2003, 03:52 PM   #5
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
Ok ,
After I added Kewpie's line the text page icon turned into a <?> executable file <?> (it is a page with a green arrow on it). But when I click on that icon the 'open with' box appears. I tried opening it with an editor but all that did was open the text editor with the lines in it. What should I open it with? One thing further: if I open a terminal and mount the floppy and then clic the floppy icon it takes around 2 minutes and forty seconds for the floppy GUI window to appear with all the icons in it. Is there any way to speed that up?
Following are the lines for the two files I created.
#mountcdrom
[code]#!/bin/bash{/code]
mount /mnt/cdrom
&
#mountfloppy
[code]#!/bin/bash[/code}
mount /mnt/floppy

Last edited by bmike1; 08-09-2003 at 04:02 PM.
 
Old 08-09-2003, 04:28 PM   #6
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
what distro are you using?
for the simplicity of this command a simple :
mount /mnt/floppy in an empty file and saving it and then chmod'ing it to being executable will suffice...
anyways it was a misprint in acids post, and you don't type them code tags as he was implying it to look like this:
Code:
#!/bin/bash
 
Old 08-09-2003, 08:24 PM   #7
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
Sorry I haven't told you the distro I am using yet; it is Debian. As for the misprint in Acid's post it was done so it wouldn't be read as html tags.
Post # 5 has included within it exactly (except the } & { are reaally a] & [) what I have written in said files. Are they incorrect? How so?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration