Advertisement

04.29.2008 at 05:47AM PDT, ID: 23361788
[x]
Attachment Details

for do loop and checking directory

Asked by bt707 in Shell Scripting

I need to run a loop with a command but as it loops through the command I need it to sleep for a bit if there is more than 3 trans logs in the db directory, not sure how to put in the sleep in this case.

for example, if I use a for loop such as this

for i in `cat file-input.txt`;do ./command $i;done

I need to do a  ---  echo `ls  /data/csdb/log* | wc -l`  

and only continue if the count is 3 or less,

so I need to put in a if statement but not sure how here.

Thanks,

Start Free Trial
[+][-]04.29.2008 at 05:59AM PDT, ID: 21461717

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Shell Scripting
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628