LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2006, 03:58 PM   #1
Murdock1979
Member
 
Registered: Oct 2003
Distribution: Slackware Debian VectorLinux
Posts: 429
Blog Entries: 2

Rep: Reputation: 30
mounting from list in files?


Hello!

I am writing a script that reads line by line from files, where each line is a device name that is then mounted.

Is there a way to read each line of the file using script and then check for end of file?

I could do it in C using file handling routines, but it's a fairly simple program that I'd like to keep as a script.


Thanks,
Murdock
 
Old 03-29-2006, 04:31 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Code:
exec 3< foobar.txt
while read -u 3 foo; do
echo Just had line $foo
done
 
  


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
C++ List Files In Directory bendeco13 Programming 8 11-02-2010 12:08 PM
how to list how many files in a directory? malaka56 Linux - Software 8 09-02-2005 05:37 AM
How to list files from a certain user?? Drunkalot Linux - General 1 06-20-2005 05:11 AM
how to: List all files more than 1mb? tobycatlin Linux - Newbie 6 05-18-2005 08:12 AM
Command to list some files? AoiSora Programming 13 10-29-2003 04:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 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
Open Source Consulting | Domain Registration