]> git.phdru.name Git - dotfiles.git/blob - bin/recode-inplace
bin/recode-inplace: Use `mktemp` instead of `python -c 'tempfile.mktemp()'`
[dotfiles.git] / bin / recode-inplace
1 #! /bin/sh
2
3 fromenc="$1"
4 shift
5
6 toenc="$1"
7 shift
8
9 tmpfile="`mktemp`" &&
10
11 for file in "$@"; do
12    iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" && cp "$tmpfile" "$file"
13 done
14
15 exec rm "$tmpfile"