]> git.phdru.name Git - dotfiles.git/commitdiff
bin/recode-inplace: Use `mktemp` instead of `python -c 'tempfile.mktemp()'`
authorOleg Broytman <phd@phdru.name>
Sun, 31 Mar 2019 16:11:17 +0000 (19:11 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 31 Mar 2019 16:11:17 +0000 (19:11 +0300)
bin/recode-inplace

index e354b870f26d8d34299a781c9bf5e573af9b9746..cb8e4e2c07a9a726fcec3d917d6c27041df3713c 100755 (executable)
@@ -6,8 +6,10 @@ shift
 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"