The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Assigning inside for loop thana Shell Programming and Scripting 2 07-25-2008 02:01 AM
reading from within the loop --std i/p problem mobydick Shell Programming and Scripting 2 07-11-2008 05:42 PM
remsh inside of while loop joettacm UNIX for Advanced & Expert Users 1 12-07-2007 08:54 AM
rsh script with inside a for loop trekianov Shell Programming and Scripting 4 01-20-2006 05:54 AM
reading filenames inside a program j_t_kim UNIX for Dummies Questions & Answers 5 04-04-2002 11:13 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
Registered User
 

Join Date: Aug 2008
Posts: 15
problem in reading inside a while loop

I am not able to read inside a while though i get the message "inside read" the cursor doesnt prompt from the console

cat file | while read ln_new_engine_dirs
do
echo "inside $ln_new_engine_dirs"
if [ "$ln_new_engine_dirs" != "" ]
then
read nn
echo "inside read"
fi
done
Thanks in advance
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 4 Weeks Ago
cfajohnson's Avatar
Registered User
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 484
Quote:
Originally Posted by ssuresh1999 View Post
I am not able to read inside a while though i get the message "inside read" the cursor doesnt prompt from the console
Code:
 
cat file | while read ln_new_engine_dirs
do
echo "inside $ln_new_engine_dirs"
if [ "$ln_new_engine_dirs" != "" ]
then
read nn 
echo "inside read"
fi
done

You are reading from the standard input which is coming from file. You need to read from the terminal, e.g.:
Code:
read nn < /dev/tty
Reply With Quote
  #3 (permalink)  
Old 4 Weeks Ago
Registered User
 

Join Date: Aug 2008
Posts: 15
Quote:
Originally Posted by cfajohnson View Post
You are reading from the standard input which is coming from file. You need to read from the terminal, e.g.:
Code:
read nn < /dev/tty
Thank you very much it works
Reply With Quote
  #4 (permalink)  
Old 4 Weeks Ago
Registered User
 

Join Date: Aug 2008
Posts: 15
Thank you very much it works
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0