]> git.phdru.name Git - dotfiles.git/commitdiff
bin: Fix some re-encoding utilities master
authorOleg Broytman <phd@phdru.name>
Thu, 21 Nov 2024 12:20:44 +0000 (15:20 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 21 Nov 2024 12:20:44 +0000 (15:20 +0300)
bin/cleanup-recode.sh
bin/cp_recode_fname
bin/get_encodings
bin/recode-inplace

index 4bf86d32cafb752b441bb0427f807ac64bc3dcf2..a957cbfbaaf7249c53945dd065d569920be3b37d 100755 (executable)
@@ -8,7 +8,7 @@ fi
 
 . get_encodings
 
-for dir in "${filenames:-.}"; do
+for dir in "${@:-.}"; do
     cleanup-filenames-recursive.sh "$dir" &&
     recode-filenames-recursive.py -f "$from_encoding" -t "$to_encoding" \
         "$dir" || exit 1
index 13fe8c2726be5015fe09ec0fda94ec6825beaa92..ad7f7d0fd6d877a09380a9be85877f2f504a5e03 100755 (executable)
@@ -12,12 +12,13 @@ case "$cmd" in
 esac
 
 . get_encodings
-if [ -z "$filenames" ]; then
+
+if [ -z "$1" ]; then
     echo "Usage: $0 [-f from_encoding] [-t to_encoding] path [path ...]" >&2
     exit 1
 fi
 
-for filename in "$filenames"; do
+for filename in "$@"; do
     filename_recoded=`echo "$filename" |
         iconv -f "$from_encoding" -t "$to_encoding"`
     if [ "$filename_recoded" != "$filename" ]; then
index 732792632234c146e0ffcd4f5f37247e98014c49..59c4be3aec9ff5ac4a445ab932df6ffe368cba9d 100755 (executable)
@@ -20,7 +20,6 @@ while getopts f:t: opt; do
    esac
 done
 shift `expr $OPTIND - 1`
-filenames="$@"
 
 error() {
     echo "$@" >&2
index 91b629a1d2d69ab468c427c540e1194e6dbd272a..149b4aed29860a3955837b5408b764d34f6fb2bc 100755 (executable)
@@ -6,7 +6,7 @@ trap "exec rm -f $tmpfile" EXIT HUP INT QUIT PIPE TERM
 
 . get_encodings
 
-for file in "$filenames"; do
+for file in "$@"; do
    iconv -f "$from_encoding" -t "$to_encoding" "$file" >"$tmpfile"
    cp "$tmpfile" "$file"
 done