On Mon, 24 May 2004 22:55:20 GMT, Robert Smith wrote:
> Scripting question:
> How would I go about checking the size of a file in directory and storing
> the size in a variable to use later?
Try this
set - $(ls -al /etc/profile)
echo $5
This is a discussion on scripting question - Redhat ; Scripting question: How would I go about checking the size of a file in directory and storing the size in a variable to use later?...
Scripting question:
How would I go about checking the size of a file in directory and storing
the size in a variable to use later?
On Mon, 24 May 2004 22:55:20 GMT, Robert Smith wrote:
> Scripting question:
> How would I go about checking the size of a file in directory and storing
> the size in a variable to use later?
Try this
set - $(ls -al /etc/profile)
echo $5
On Mon, 24 May 2004 23:06:33 GMT, Bit Twister
wrote:
>On Mon, 24 May 2004 22:55:20 GMT, Robert Smith wrote:
>> Scripting question:
>> How would I go about checking the size of a file in directory and storing
>> the size in a variable to use later?
>
>Try this
> set - $(ls -al /etc/profile)
> echo $5
Or this...
[root@www tmp]# cat root/bin/sizeof
#!/bin/bash
/usr/bin/stat -c %s $1
#eof
An example of usage would be something like...
LIMIT=1000
for FILE in *
do
SIZ=`sizeof $FILE`
if $SIZ > $LIMIT
then
echo "$FILE is > $LIMIT"
else
echo "$FILE is <= $LIMIT"
fi
done
Brad
--
"Laughter is good medicine and it has no bad side effects."
Unknown
Bradley W. Olin
http://www.bwo1.com
On Tue, 25 May 2004 01:14:19 GMT, Brad Olinwrote:
> if $SIZ > $LIMIT
Whoops, that should read...
if $SIZ -gt $LIMIT
integer compare vrs string compare
Brad
--
"Laughter is good medicine and it has no bad side effects."
Unknown
Bradley W. Olin
http://www.bwo1.com