脚本 t2s.sh
------------------
#!/bin/sh
# 繁简体中文习惯用语对译工具 T2S 0.1
# Come From AutoWork Toolkits.
# Welcome to our team: http://i18n.linux.net.cn
# Copyleft Liu Songhe 2003.
export basedir=`pwd`
export dic="$basedir/dic/t2s.dic"
sh ./replace.sh `wc -l $dic`
脚本 replace.sh
------------------
#!/bin/sh
export tc=""
export sc=""
export count=1
export line=`expr $1 + 1`
file=""
cd ./target
for file in *
do
if test -f "$file"
then
export file
cat "$file" | sh "$basedir/look.sh"
fi
done
脚本 look.sh
------------------
#!/bin/sh
if test $count -le $line
then
export tc=`sed -n "$count"p $dic | awk -F# '{print $1}'`
export sc=`sed -n "$count"p $dic | awk -F# '{print $2}'`
export count=`expr $count + 1`
sed -e "s/$tc/$sc/g" - | "$basedir/look.sh"
exit
fi
cat - > "$basedir/done/$file"