From: Oleg Broytman Date: Fri, 11 Aug 2023 10:58:11 +0000 (+0300) Subject: Refactor(bin/recode-inplace) X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=ee139d78efb0d8d8f097c434c45c3d240571c996;p=dotfiles.git Refactor(bin/recode-inplace) --- diff --git a/bin/recode-inplace b/bin/recode-inplace index cb8e4e2..77ff306 100755 --- a/bin/recode-inplace +++ b/bin/recode-inplace @@ -1,15 +1,14 @@ #! /bin/sh fromenc="$1" -shift - -toenc="$1" -shift +toenc="$2" +shift 2 tmpfile="`mktemp`" && for file in "$@"; do - iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" && cp "$tmpfile" "$file" + iconv -f "$fromenc" -t "$toenc" "$file" >"$tmpfile" && + cp "$tmpfile" "$file" done exec rm "$tmpfile"