]> git.phdru.name Git - dotfiles.git/blobdiff - bin/recode-inplace
Fix(bin/cp_recode_fname): Fix misspelled message
[dotfiles.git] / bin / recode-inplace
index e354b870f26d8d34299a781c9bf5e573af9b9746..77ff3063f46ce5dc62fb0191706959ec4e592a19 100755 (executable)
@@ -1,13 +1,14 @@
 #! /bin/sh
 
 fromenc="$1"
-shift
+toenc="$2"
+shift 2
 
-toenc="$1"
-shift
-
-tmpfile="`python -c 'import tempfile; print tempfile.mktemp()'`" &&
+tmpfile="`mktemp`" &&
 
 for file in "$@"; do
-   iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" && cp "$tmpfile" "$file" && rm "$tmpfile"
+   iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" &&
+   cp "$tmpfile" "$file"
 done
+
+exec rm "$tmpfile"