df command

I have done this command:
df -b /opt/mysql

then it gave me the Filesystem info and the Avail. Now is there away that I can just list the avial number. because i want to be able to take that number put it in an if statement in a script.

My script statement looks like this so far:

h=`df -b /opt/mysql`
echo $h
if [ $h<=20000000 ]
then
echo "this file is ready to be archive"
fi
done

so can this be done?

My box gives df -b output that looke like this:

/home                  (/dev/vghome/lvhome    ) :  4228052 Kbytes free 
df -b /path | awk -F: '{print $2}' | read blocks dummy1
echo "$blocks"
if [ "$blocks" < "20000001" ]   
then                                   
    echo "this file is ready to be archived"
fi    

I tried your way and it did not work when i tried running the script. This is what I got when i ran the script:
>./highwater
./highwater: {print: not found
awk: syntax error near line 2
awk: bailing out near line 2

./highwater: 20000000: cannot open

Did you try it your way? If so did it work?

You should have revealed to us what Unix derivative you are running the df command on.
I found the -b flag only to be known to the HP-UX and Solaris df implementations,
though their output and thus the required parsing could deviate slightly.
What about
(n.b. this only works on HP-UX as the Solaris df -b isn't displaying the colon :wink:

if (( $(df -b /opt/mysql|cut -d: -f2|tr -dc '[0-9]') <= 20000000 )); then
   echo "Filesystem ready to be archived"
fi

This is what my code looks like:

h=`df -b /opt/mysql`
echo $h
if ( (df -b /opt/mysql|cut -d: -f2|tr -dc `[0-9]`) <= 20000000 );
then
   echo "Filesystem ready to be archived"
fi

Is this right?
If wrong let me know what I did wrong and show what I should do.

To answer your

To answer your question - it does work.
What you have is neither what Buffonix nor I gave you.

Buffoonix gave you a csh answer, mine was in ksh on HPUX. You need to give us a sample of your df -b output if you want it to work.