How do I write a bash shell script (under Mac OS X) to convert the names of various files with special characters such as ä, ö, ü? Using sed doesn't work:
echo * | sed s/ü/ue/
Can I do it some other way?
EDIT
Here is the full script. It basically zips up iPhone app packages and then (should) convert any special characters in the zip file name:
#/bin/bash
for appfile in *.app
do
zipfile=`echo ${appfile} | sed s/app/zip/`
zipfile=`echo ${zipfile} | sed s/\ /_/`
# these don't work...
zipfile=`echo ${zipfile} | sed s/ä/ae/`
zipfile=`echo ${zipfile} | sed s/ö/oe/`
zipfile=`echo ${zipfile} | sed s/ü/ue/`
zipfile=`echo ${zipfile} | sed s/ß/ss/`
# make zip
zip -ruy0 "${zipfile}" "${appfile}"
done
EDIT
Got it!! The trick is to run the filename through iconv to convert the encoding. I did this before doing the äöü replacements and it worked:
zipfile=`echo ${zipfile} | iconv -f utf-8-mac -t utf-8`