#!/bin/bash for image in *.$1 do TARGET=$(echo $image | sed s/.$1/.png/) convert $image $TARGET done