Register
It is currently Thu Apr 24, 2014 7:35 pm

Script to mount directories listed in a file.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Fri Jan 25, 2008 3:50 pm   

Joined: Fri Jan 25, 2008 3:46 pm
Posts: 1
I need help writing a script.

What I need to do is take a file which has a list of directories that I need to mount and feed that into a bash script. Any ideas?

ex: mount $MNTDIR /mnt/script mount

And the $MNTDIR would come from a file that lists a bunch of directories. Of course it would go in a loop and mount them all. I just don't know how to get a variable from a file


Top
 Profile  
 PostPosted: Tue Jan 29, 2008 6:12 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 224
Location: London - UK
Hi,
It's not very clear what you're after, however to loop through the contents of a file you can use the following.

Code:
while read myline
do
  # some operations here
  # $myfile contains each line in turn of the inputfile
done < inputfile


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP