LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-06-2012, 04:20 PM   #1
fcvan29
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Rep: Reputation: Disabled
while loop


if someone could help me with the understanding of "while loop"
 
Old 09-06-2012, 04:22 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,076

Rep: Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861Reputation: 861
bash:
Code:
while [ condition ]
do
 commands
done
c:
Code:
while(condition)
{
 calls to functions and/or assignments
}
as long as the conditions in the test are true for each iteration then re-run the commands within the body.

Last edited by schneidz; 09-06-2012 at 04:25 PM.
 
1 members found this post helpful.
Old 09-06-2012, 05:04 PM   #4
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Rep: Reputation: Disabled
Test a condition. While that condition is true, execute a block of code then return back to the while condition. It keeps looping until the condition tests false.
 
1 members found this post helpful.
Old 09-07-2012, 02:42 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
It might help if you first explained what you think you know already, and what you aren't certain about. If you have any specific questions, please post them directly.

We aren't here to be your teachers; there are various tutorials and other instructional aids for that. We're here to help you when you have specific problems with something.
 
1 members found this post helpful.
Old 09-16-2012, 10:48 AM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
Well fcvan29, I see you marked my post as helpful. Thank you.

But it would be even better if you also followed up with an actual reply or two to the comments you received. These forums are intended as dialogs, and we appreciate having our efforts acknowledged.
 
1 members found this post helpful.
Old 09-16-2012, 12:35 PM   #7
fcvan29
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
To all who help me wi my " while loop ", question I thank you. I'm brand new to programming, and I'm really loving it. sometimes you need help from others to help you get a better understanding. Again thank you all.
 
Old 09-17-2012, 06:19 AM   #8
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
Thank you for the kind response. Feel free to come back when you have more questions. (But again, try to limit it to specific problems, please.)
 
  


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
how to loop over text file lines within bash script for loop? johnpaulodonnell Linux - Newbie 9 07-28-2015 03:49 PM
[SOLVED] Bash - While Loop reading from two lists simultaneously - nested while loop wolverene13 Programming 11 10-01-2011 05:00 PM
for loop or while loop to read the fields of a file.. visitnag Linux - Newbie 10 09-02-2010 08:47 PM
bash loop within a loop for mysql ops br8kwall Programming 10 04-30-2008 03:50 AM


All times are GMT -5. The time now is 01:49 AM.

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