cancel
Showing results for 
Search instead for 
Did you mean: 

ksh script Agian !!

SOLVED
Go to solution
zap_2
Advisor

ksh script Agian !!

Dear my friends,

Dear my friends,

I have below script:

if [ "$x" != "0" ]; then
cat $y | while read LINE
do
is_ok=1
until [ $is_ok -eq 0 ]; do
cp -p $z${LINE} /eva/bulk/tmp/${LINE}
cmp -s $z${LINE} /eva/bulk/tmp/${LINE}> /dev/null
is_ok=$?
done
is_ok=1
until [ $is_ok -eq 0 ]; do
rm -f /eva/bulk/tmp/${LINE}.gz
usr/contrib/bin/gzip /eva/bulk/tmp/${LINE}
is_ok=$?
done
MD5A=$(md5sum /eva/bulk/tmp/${LINE}.gz | cut -c 1-32)
MD5B="0"
until [ "$MD5A" = "$MD5B" ]; do
remsh remserver -l root -n rm -f /cx/arc/${LINE}.gz
rcp -p /eva/bulk/tmp/${LINE}.gz remserver:/cx/arc/${LINE}.gz
MD5B=$(remsh remserver -l root -n md5sum /cx/arc/${LINE}.gz|cut -c 1-32)
MD5A=$MD5B?
done

done

else echo "There are no files to be copied................."
fi

How to check so the last looping (rcp) has match the test value (MD5A=MD5B).Because my above script still looping and the check does not work.Thanks in advanced.
1 REPLY
Kenan Erdey
Honored Contributor
Solution

Re: ksh script Agian !!

Hi,

you can go on from previous thread.

as answer you don't need MD5A=$MD5B? in loop. remove it.

in loop you copy the file and get the checksum. and if local and remote are same exit the loop. so you must compare local and remote file cheksum( MD5A and MD5B)
Computers have lots of memory but no imagination