The following is the script I use in Macbook (Mountain Lion). It should work on most /*nix shell like bash, csh, ksh etc.
However, I have tested it only in bash.

Script to change extension for multiple filesview raw
1
2
3
4
5
##!/usr/bin/env bash
for f in *.$1; do
[[ -f "$f" ]] && mv -v "$f" "${f%$1}$2"
done

Save this file as “chext”, make it executable chmod +x chext and add to your $PATH.

Now you can use it like this:

Usage
1
2
cd path-to-dir
chext oldextension newextension
Example
1
chext JPG jpg

Reference: