#!/bin/bash [ -z "$2" ] && "echo usage: 0 " && exit 1 FILES=$3 [ -z "$FILES" ] && FILES=*.$1 for i in $FILES; do echo $(basename $i .$1).$2; done