> for FILE in *jpg; do > NEW=$(echo $FILE | sed -e 's/\.jpg$/_thumb.jpg/') > mv "${FILE}" "${NEW}" > done
There is no need for echo and sed. OpenBSD sh and ksh support ${var%suffix} which evaluates to the contents of var less the suffix. for f in *.jpg; do mv $f ${f%.jpg}_thumb.jpg; done does the trick in one line. // marc