The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read lines till a blank line is encountered saurabhsinha23 UNIX for Dummies Questions & Answers 1 12-19-2007 04:26 PM
how to read a file till it encounters a blank line adityam UNIX for Dummies Questions & Answers 1 11-26-2007 02:26 AM
how to read a file till it encounters a blank line adityam Shell Programming and Scripting 1 11-26-2007 02:15 AM
how to read a file till it encounters a blank line adityam Post Here to Contact Site Administrators and Moderators 0 11-26-2007 01:51 AM
Read file based on condition sbasetty Shell Programming and Scripting 5 02-01-2007 02:54 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-21-2006
senthilk615 senthilk615 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 16
need to read a file and keep waiting till it satisfies some condition

In my script i am writing to a counter file the no of processes i had started,
that is each time i start a process, i will increment the content of counter file and also when the process ends i will decrement the content of the file.

after this i do some other activities, by now i want to decide to execute further or wait till the processes i started earlier got over.

So i keep reading the counter file for till content becoming zero.
I am confused of writing the above part in script please help me writing a loop to keep reading the file till the contents become zero.

regards,
Senthil
  #2 (permalink)  
Old 03-22-2006
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Since you didn't post your OS/version or even the shell you are using OR any of the script - one can only guess that this thread will help.
Specifically:
Code:
while [ $(( THREAD_CNT - 1 )) -gt 0 ]
            do
                update_process_status \
                     ${RUN_ID:-0} \
                     ${P_FN_CD} \
                     "InProgress" \
                     "staging ${FILE_TYPE} - sqlldr - threads still running: $(( THREAD_CNT - 1))" \
                     0
                sleep 2
                THREAD_CNT=$(ps -p $(print ${PID_LIST} | tr -d ' ' | nawk '{print substr($0,1,length($0)-1)}') | wc -l)
            done
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0