From: Oleg Broytman Date: Sun, 31 Mar 2019 16:11:17 +0000 (+0300) Subject: bin/recode-inplace: Use `mktemp` instead of `python -c 'tempfile.mktemp()'` X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=commitdiff_plain;h=2933afe00834013f15601be7043ce514020f0309 bin/recode-inplace: Use `mktemp` instead of `python -c 'tempfile.mktemp()'` --- diff --git a/bin/recode-inplace b/bin/recode-inplace index e354b87..cb8e4e2 100755 --- a/bin/recode-inplace +++ b/bin/recode-inplace @@ -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"