|
Thanx for ur reply....
ok ...i will explain my problem that what exactly i want....
i am basically writing a program for backup...of a particular directory , if it's size increased by 1024 bytes everytime.
i have two files with me
1. flag
2. size
initially flag has a value 0
prg will first read this file and if the value is 0 then it will take size of /dir through du command and store it in the file size.
and also the value of flag file will change to 1.
now the second time again flag file wll be readed and as now the value is changed to 1 so here the need arise to have the value from the size file and store it in a variable and then through some calculations compare it and judge that if the resultant value is greater than or equal to 1024 bytes than again du coomand should run and take the backup in a new file...
so for thsi scenario i need awk command and off course need to store the value...
so my code is something like...
du -sb /home > size
awk '{ if ( $1 == 0 )
{
du -sb /home > newsize
TAKE BACKUP
echo 1 > flag
}
else
{
awk '{ var1=$1 }' size
awk '{ var2=$1 }' newsize
if ( (var1-var2) >= 1024 )
{
TAKE BACKUP
du -sb > newsize
}
}
}' flag
my code is not exactly same but something of this sort....
but here else part is not at all working...
the problem i am facing is that awk with in another awk is not running ,
niether i am able to store the output of awk in any variable which i can use further.....
i hope u understand my problem well....
pls guide me in a right direction.....
TAKE CARE
|