do while loops ? 
Author Message
 do while loops ?

I have a small script that works but is not very tidy

#!/bin/csh
echo "date now is" > SIZE
date >> SIZE
ls -lrt /scratch/x* >> SIZE
ls -lrt /scratch/d* >> SIZE
echo "" >> SIZE
ls -lrt /scratch31/x* >> SIZE
echo "" >> SIZE
ls -lrt /userscfd/x* >> SIZE
echo "" >> SIZE
ls -lrt /userscfd2/x* >> SIZE
echo "" >> SIZE
sleep 900

I cut & paste this several 100 times and submit it
Its write out the size of several files while an analysis is running, I
ususally kill it once the analysis has finished.

How could I make use of do while loops to just specify a length of time
over which the script should run?

Many thanks

--

DCH Consultancy Ltd.               http://www.*-*-*.com/
Goslings, Manor Farm, West Coker  Tel: +44 (0)1935 862 081
Somerset, England, BA22 9DT       Fax: +44 (0)1935 864 131



Wed, 14 Aug 2002 03:00:00 GMT  
 do while loops ?
Awk problem??
I wouldn't use the csh just cos i don't know it but with ksh do
something like

#!/bin/ksh

# Parameter is total time in seconds
TotalTime=$1

# Initialize SIZE file

Quote:
> SIZE

CurrentTime=0
while [ $CurrentTime -lt $TotalTime ]
do
    (
    echo "date now is"
    date
    ls -lrt /scratch/x*
    ls -lrt /scratch/d*
    echo
    ls -lrt /scratch31/x*
    echo
    ls -lrt /userscfd/x*
    echo
    ls -lrt /userscfd2/x*
    echo
    ) >> SIZE
    sleep 900
    let "CurrentTime=CurrentTime + 900"
done
exit 0

Be aware that I have not tested this code!!

Cheers
Luke

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Sat, 17 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Please take a look at this expect script doing in loop with error checking

2. Doing assembly and really doing assembly

3. Doing assembly and really doing assembly

4. break one loop and skip one iteration of outer loop

5. 2 files: a loop within a loop??

6. Problem with loop inside other loop

7. Impelement for loop and do while loop

8. using while loops within while loops?

9. Fast loop inside a slow loop?

10. Troubles using while loops and case loops

11. For Loop looping only once

12. nested while loops, inside loop not stopping correctly

 

 
Powered by phpBB® Forum Software