shell脚本批量转文件格式:dos2unix

文章目录


可以使用shell脚本实现:

#!/bin/sh

dir=$PWD
if [ $# -gt 1 ]
then
    howUsage
fi
if [ $# -gt 0 ]
then
    dir=$1
fi


for i in `find $dir`
do
    if [ ! -d $i ]
    then
        echo "processing file..." $i
        dos2unix $i $i
    fi
done

howUsage()
{
    echo "Usage: dos2unix dir [destdir]"
    exit 0
}

你可能感兴趣的:(Linux,linux)