shell脚本 dos文件转unix 类似dos2unix命令

来源:互联网 发布:贵州广电网络电话多少 编辑:程序博客网 时间:2024/05/23 11:42
#! /bin/shdostype=dosIFS=$(echo -en "\n\b")function iterate_dir(){for file in $1/*; doif [ -f $file ]; thentypename=`file $file | grep -q CRLF && echo dos || echo unix`if [[ $typename == $dostype ]]; thensed -i "s/.$//g" $fileecho 'converting '$fileelse:fielseiterate_dir $filefidone}if [ "$1" == "" ]; thenecho 'convering start'`pwd`iterate_dir .elseecho 'convering start'$1iterate_dir $1fi

0 0