]> git.phdru.name Git - dotfiles.git/commitdiff
Refactor(bin/recode-inplace)
authorOleg Broytman <phd@phdru.name>
Fri, 11 Aug 2023 10:58:11 +0000 (13:58 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 11 Aug 2023 10:58:11 +0000 (13:58 +0300)
bin/recode-inplace

index cb8e4e2c07a9a726fcec3d917d6c27041df3713c..77ff3063f46ce5dc62fb0191706959ec4e592a19 100755 (executable)
@@ -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"