Shrink all images

#!/bin/bash

l=$(ls)


mkdir ../shrink

for s in $l
do
    if [ -d $s ]
    then
        echo "$s"
        mkdir ../shrink/$s
        cd "$s"
        m=$(ls)
        for t in $m
        do
            if [[ $(file -b $t) =~ PNG ]]
            then
               convert -resize 20% $t "../../shrink/$s/$t"
               echo $t
            elif [[ $(file -b $t) =~ JPEG ]]
            then
                convert -resize 20% $t "../../shrink/$s/$t"
                echo $t
            fi
        done
        cd ..
    fi
done

#!/bin/bash

l=$(ls)

mkdir shrink

for s in $l
do
            if [[ $(file -b $s) =~ PNG ]]
            then
               convert -resize 20% $s "./shrink/$s"
               echo $t
            elif [[ $(file -b $s) =~ JPEG ]]
            then
                convert -resize 20% $s "./shrink/$s"
                echo $t
            fi
done