Visit Jeremy's Blog.
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 12-25-2005, 05:52 PM   #1
LQ Newbie
Registered: Dec 2005
Posts: 12

Rep: Reputation: 0
for loop only works properly on first loop

in the following batch file the for loop performs the correct function on the first loop and then on the following loops it will only echo $entry... how do i make it output
every time it loops?


for entry in "`cat list1.list`"

echo `pwd`/"$entry"



/mnt/sda5/music/"song 1"
"song 2"
"song 3"
"song 4"
"song 5"
Old 12-25-2005, 06:17 PM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110

while read entry ; do
    echo $PWD/"$entry"
done <list1.list


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
while loop or for loop? mijohnst Programming 18 11-21-2005 05:48 PM
No loop# SeaSharp Linux - Newbie 3 09-06-2005 09:14 PM
WHILE LOOP in 'C' ']['HeBroken Programming 4 10-29-2004 02:42 AM
for loop klfreese Programming 16 08-11-2003 12:09 PM
help with the following C loop ..... purpleburple Programming 12 08-06-2002 11:32 PM

All times are GMT -5. The time now is 02:14 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