SH Script to Rename .apk.odex files
That's rather a shell scripting question to be asked at Super User. Your answer can be found here: Extract filename and extension in bash:

for file1 in $SYSAPP*.apk.odex; do
    mv "${file1}" "${file1%.*}.odex" 
done
for file2 in $SYSPRIVAPP*.apk.odex; do
    mv "${file2}" "${file2%.*}.odex"
done


should work on most shells, supposedly.

Update:

You can even omit half of your script by adapting this to your original statements: dexopt-wrapper $i1 ${i1%.*}.odex should create the file with the correct naming, so no need to rename it later. To make your script real short and handy:

#!/bin/sh
SYSAPP=/mnt/extSdCard/FilesToOdex/system/app/
SYSPRIVAPP=/mnt/extSdCard/FilesToOdex/system/priv-app/

for i1 in $SYSAPP*.apk $SYSPRIVAPP*.apk; do
    echo "Odexing $i1..."
    dexopt-wrapper $i1 ${i1%.*}.odex
done


That's all you should need :)