#!/usr/bin/env bash BASE=$1 if [[ $BASE == *ja* ]]; then ENCODING=shift-jis if [[ $BASE == *2022-mainichi* ]]; then ENCODING=unicode fi else ENCODING=unicode if [[ $BASE == *2016a-yubikiri-old* ]]; then ENCODING=gbk fi fi for f in $BASE/*.ks; do iconv -f $ENCODING -t utf-8 < $f > $f.tmp mv $f.tmp $f done