read is not on hold


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting read is not on hold
# 8  
Old 09-04-2012
Don't get too distracted with the here-document construct. It is the same as if you saved it into a file, and then fed the file into a while loop via < operator:
Code:
while [] ; do 
   ...
done < file

That open descriptor won't get closed until the while loop is over. In your case never. So read still is reading from that file descriptor (which is not stdin).

The usual construct
Code:
while read line ; do 
   #something with $line
done < file

uses the return value of read builtin (effectively getline() function), which will terminate the while loop when eof encountered.
This User Gave Thanks to mirni For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variable hold in UNIX job

In log directory file contain log files and files contain some unique job name which is dynamically created (example=55555 ),if job get 55555 then send alert message, but after next run if it find ---55555 then no need send alert message While checking the first job name you are capturing the Job... (3 Replies)
Discussion started by: Kalia
3 Replies

2. Shell Programming and Scripting

Hold buffer in sed

Hi Experts, i have a file like below **** table name is xyz row count for previous day 10 row count for today 20 diff between previous and today 10 scan result PASSED **** table name is abc row count for previous day 90 row count for today 35 diff between previous and today 55... (4 Replies)
Discussion started by: Lakshman_Gupta
4 Replies

3. Shell Programming and Scripting

Hold, Replace and Print with sed

Hi, I'm a newbie with scripting so I'd appreciate any help. I have a file import.txt with below text AA_IDNo=IDNoHere AA_Name=NameHere AA_Address=AddressHere AA_Telephone=TelephoneHere AA_Sex=SexHere AA_Birthday=BirthdayHere What I need is that the Lines for Name, Address and... (3 Replies)
Discussion started by: heretolearn
3 Replies

4. Shell Programming and Scripting

Hold buffer in perl

Hi, Can any one tell me is their any "hold buffer" in perl similar to sed. I have to find a pattern, once that pattern found then need to go backward and find another pattern and print. Example: Below are the contents present in a file ## block IPs URLs URL_IPs Unblock URLs ... (4 Replies)
Discussion started by: Anjan1
4 Replies

5. Shell Programming and Scripting

sed: hold buffer question

I've been using sed to help with reformatting some html content into latex slides using the beamer class. Since I'm new to sed, I've been reading a lot about it but I'm stuck on this one problem. I have text that looks like this: ******************* line of text that needs to be... (4 Replies)
Discussion started by: tfrei
4 Replies

6. Shell Programming and Scripting

What's the max integer a variable can hold?

I would like to know the maximum integer that a variable can hold. Actually one of my variable holds value 2231599773 and hence the script fails to process it.Do we have any other data type or options available to handle this long integers? (9 Replies)
Discussion started by: michaelrozar17
9 Replies

7. Shell Programming and Scripting

Hold previous date

A file named abc.txt being updated with date value by one process. Say , today it s updating the file with value 01-09-2009 Fine. Tomorrow the process will override the file with tomorrow date (02-09-2009) .Insome case the process will overriding the file with empty string. So I... (1 Reply)
Discussion started by: Gopal_Engg
1 Replies

8. UNIX for Dummies Questions & Answers

Determining which processes hold a semaphore

I have a situation where I have created a semaphore and set it's value to 10. I am using this semaphore to control access to a shared memory location. I can have 10 processes simultaneously read from the shared memory location, process 11 would get locked out. My question is, is there a way I... (6 Replies)
Discussion started by: tpotter01
6 Replies

9. UNIX for Advanced & Expert Users

MAX SIZE ARRAY Can Hold it

Hi, Do anyone know what's the max size of array (in awk) can be store before hit any memory issue. Regards (3 Replies)
Discussion started by: epall
3 Replies

10. UNIX for Dummies Questions & Answers

Support Needed: Education On Hold

I'm Presently Writting A College Report On Operating Systems, Not Enjoying It Very Much. I Was Hoping Someone Could Direct Me To A Site Where I Could Get Information Such As The Role Of Operating Systems, Types Of Operating Systems (Multi-User Multi-Tasking etc), Modes Of Operating systems... (3 Replies)
Discussion started by: OSNovice
3 Replies
Login or Register to Ask a Question