[plug] bash script program help
Russell Steicke
r.steicke at bom.gov.au
Wed Jan 11 09:35:27 WST 2006
On Wed, Jan 11, 2006 at 09:16:22AM +0800, Lance Duivenbode wrote:
> Another way is to use cut(1):
>
> #!/bin/sh
>
> fileA=$1
> fileB=$2
>
> sizeA=`du $fileA | cut -f 1`
> sizeB=`du $fileB | cut -f 1`
Be careful with du, as it will print sizes in kilobytes (with GNU
utilities) or 512 byte units (on BSDs I think, and some POSIX
commercial unixes), and when doing that will round up to the
filesystem's block size.
$ ls -l A
-rw-r--r-- 1 russells resswa 802 2006-01-11 08:45 A
$ du A
4 A
$ POSIXLY_CORRECT=1 du A
8 A
$ du --bytes A
802 A
$
--
Russell Steicke
-- Fortune says:
But what can you do with it? -- ubiquitous cry from Linux-user partner.
(Submitted by Andy Pearce, ajp at hpopd.pwd.hp.com)
More information about the plug
mailing list