#! /bin/sh set -e tmpfile="`mktemp`" trap "exec rm -f $tmpfile" EXIT HUP INT QUIT PIPE TERM . get_encodings for file in "$@"; do iconv -f "$from_encoding" -t "$to_encoding" "$file" >"$tmpfile" cp "$tmpfile" "$file" done