#!/bin/bash for i in "$@" do if jhead "$i" | grep -q 'Comment.*: Jen'; then mv "$i" "${i%%.jpg}"-jen.jpg echo "$i (jen)" else echo "$i" fi done