Dexter Filmore wrote:
> I hacked up this script to monitor at what rate a file grows:
> 
> #!/bin/bash
> LASTSIZE=`ls -s "$1" | cut -d" " -f1`  #size now, init
       -s, --size
              print size of each file, in blocks

> So far, so good. Now the script as such works, but always gives me integers. 
> When uncommenting the line that echoes the raw values I noticed, the 
> difference from one second to the next is *always* 3072k or 4096k, maybe 
> sometimes +4k.
> Where's my concept error?

ls --size --block-size=1 $1 | cut -d" " -f1

will return the filesize, in bytes.

As a general note, I tend to recommend using the long options in
scripts. It helps in documentation.

-john


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to