#!/usr/local/bin/ksh for d in "$@" do g=1 ls -1 $d/* > temp_${d}_1_$$ 2> /dev/null while [[ -s temp_${d}_1_$$ ]] do if (( $g < 10 )) then g=0$g fi if (( $g < 100 )) then g=0$g fi print "g: $g" head -20 < temp_${d}_1_$$ > temp_${d}_2_$$ tail +21 < temp_${d}_1_$$ > temp_${d}_3_$$ wc -l temp_${d}_1_$$ wc -l temp_${d}_2_$$ wc -l temp_${d}_3_$$ cat temp_${d}_2_$$ temp_${d}_3_$$ > temp_${d}_4_$$ diff temp_${d}_1_$$ temp_${d}_4_$$ cat temp_${d}_2_$$ | thumbs.pl > thumbs/thumbs_${d}_${g}.html mv temp_${d}_3_$$ temp_${d}_1_$$ rm -f temp_${d}_[234]_$$ (( g++ )) done rm -f temp_${d}_1_$$ done