in reply to size of a file

I don't really understand how the size command works, so say if I'm in /tmp and I have a file called 'hello'. What I want to do is determine the size of the size 'hello' and store the size size as 'size_of_hello' eg: size -s "/tmp/hello" = "size_of_hello"

Replies are listed 'Best First'.
Re: Re: size of a file
by goldclaw (Scribe) on Jan 18, 2001 at 17:18 UTC
    As was just mentioned:
    $size_of_hello= -s "/tmp/hello";
    I have no idea where you have found a size command. Its not a perl builtin. On my Solaris workstation I have an executable called size, but it is used to print the sizes of sections in object files, probably not what you want.
Re: Re: size of a file
by Jonathan (Curate) on Jan 18, 2001 at 17:22 UTC
    Do you mean something like this?
    $size= -s $file; die "Can't open file $!" unless open NEWFILE, ">/tmp/size_of_hello"; print NEWFILE $size,"\n"; close NEWFILE;