demonjinn
07-22-2002, 06:15 PM
I'm writing a script to list the files and sizes in a directories, then I want to test the size of the file so if its over 100(example) then I want it to echo. The problem I think is that it's trying to test string, the following is what I have, any improvements, or comments are very welcome. Thanks.
#!/bin/bash
for file in $(dir); do
tmp=`du $file`
size=`echo $tmp | cut -d' ' -f1`
echo $file $size
if ["$size" -gt 100]; then
echo $file is bigger then 100.
fi
done
yours
jinn
#!/bin/bash
for file in $(dir); do
tmp=`du $file`
size=`echo $tmp | cut -d' ' -f1`
echo $file $size
if ["$size" -gt 100]; then
echo $file is bigger then 100.
fi
done
yours
jinn