Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-16-2001, 10:23 AM   #1
LQ Newbie
Registered: Jul 2001
Posts: 2

Rep: Reputation: 0
Question Script, Reading a file, When end of file?

Hello everybody,

I am a new Linux user, I am creating a small script to read a file and count the number of lines that it has, so I do bucle read while is not the end of the file, but I do not know how to find out
when the end of the file has been reach.

Can somebody help me?

Old 07-16-2001, 10:30 AM   #2
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
Was this just a shell scripting experiment? If so ignore this! If not, and you actually need to count the number of lines in a file how about
wc -l myFile

Old 07-16-2001, 11:01 AM   #3
LQ Newbie
Registered: Jul 2001
Posts: 2

Original Poster
Rep: Reputation: 0
Yes, it is a shell scripting experiment, but is very usefull what you
told me because now I can do a bucle that stops when the last line has been read.




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
Reading a conf file from a BASH script dinolinux Programming 5 08-03-2005 04:18 AM
Pop3 Command stream end of file while reading line sesimonsen Linux - Networking 0 05-13-2005 12:29 PM
Bash script - reading from text file twantrd Programming 4 11-24-2004 12:38 AM
reading file, bash script marri Programming 3 11-15-2004 09:13 AM
my script has no end of file!?? box_l Programming 4 07-26-2004 05:18 AM

All times are GMT -5. The time now is 04:18 AM.

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