LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 01:56 AM   #1
bmike1
Member
 
Registered: Jul 2003
Posts: 132

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, 02:10 AM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
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, 02:57 AM   #3
bmike1
Member
 
Registered: Jul 2003
Posts: 132

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, 03:55 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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

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 05:02 PM.
 
Old 08-09-2003, 05:28 PM   #6
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
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, 09:24 PM   #7
bmike1
Member
 
Registered: Jul 2003
Posts: 132

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:19 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-12-2005 12:08 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 11:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 01:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 05:21 PM

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

All times are GMT -5. The time now is 09:42 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration