#!/bin/sh case "$1" in *.[Xx][Bb][Mm]) f="${1%.[Xx][Bb][Mm]}.jbg}";; *) f="$1.jbg";; esac xbmtopbm "$1" | pbmtojbg -q >"$f" .