Re: How to compare file size in script?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



=>Hongwei Li wrote:
=>> Hi,
=>> 
=>> I want to write a script to compare file sizes.  My script is like this:
=>> 
=>> #!/bin/sh
    #!/bin/bash
=>> ls -l /tmp/test/t1 | awk '{print $5}' > thesize
    set -- (ls -l /tmp/test/t1)
    filesize=$5
=>> echo `cat thesize`
    echo $filesize
=>> if [ `cat thesize` > 300000 ]
    if (( filesize > 300000 ))
=>> then
=>>         echo "big file: thesize"
=>>         exit 0
=>> fi
=>> 
=>> But, no matter how small or big the file t1 is, it always display:
=>> 


-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux