for z in 1 2 3 4 5 6
do
    zcat ppm/foo$z.ppm.gz | cjpeg -quality 90 > foo$z.jpg
done