

免费资源网 – https://freexyz.cn/
这篇文章主要介绍了编写shell脚本,使用iconv批量改变文件编码的脚本代码,需要的朋友可以参考下。
用法示例:
cd ~/workspace/XXXProject ~/iconv_shell.sh ./ *java好了,直接上代码~~
#!/bin/bash if [ “$#” != “2” ]; then echo “Usage: `basename $0` dir filter” exit fi dir=$1 filter=$2 echo $1 for file in `find $dir -name “$2″`; do echo “$file” iconv -f gbk -t utf8 -o $file $file done这里还有些修改的余地,比如源和目标编码应该作为参数,我暂时没有这个需求,懒得写了。
免费资源网 – https://freexyz.cn/
© 版权声明
THE END
暂无评论内容