[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On 9/19/07, Rob Beard <rob@xxxxxxxxxxxxx> wrote: > Hi folks, > > I'm trying to write a bash script to check if a file is larger than a > certain size (say 15KB) and if it isn't to run another command. > Parse the output of ls -l, heres a quick probably crappy inefficient hack :- #!/bin/bash file=$1 line=$(ls $file -l) x=0 for i in $line; do eval "fields${x}=\"$i\"" x=$((x+1)) done size=$fields4 if [ $size -gt 1000000 ]; then echo "Thats a big file!" else echo "Thats not so big!" fi -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html