#! /bin/csh #------------------------------- # : max count # : right file size #------------------------------- set cmax=5 set right_size=1215 #------------ # reset count #------------ set ct=0 #-------------- # get file size #-------------- set fsize=`wc -c sleep_testing.csh | cut -d' ' -f1` #---------------------------------------------------------- # loop if count is not max-count yet and file size is wrong #---------------------------------------------------------- while( ${ct} < ${cmax} && ${fsize} != ${right_size} ) #---------------------- # pause for 1.5 seconds #---------------------- sleep 1.5s #--------------------- # increment count by 1 #--------------------- @ ct ++ #---------------------- # get file size (again) #---------------------- set fsize=`wc -c sleep_testing.csh | cut -d' ' -f1` #---------------------------- # print out count & file size #---------------------------- echo ${ct} ${fsize} end #-------------------------------- # do different things accordingly #-------------------------------- if( ${fsize} == ${right_size} ) then echo "File size is correct" else echo "#### File size is wrong" endif exit