将指定目录下sh脚本全部转换成unix格式。
dos2unit xx.sh
写个脚本:
shell2unix.sh
#!/bin/bash
if [ $# == 1 ] || [ $# == 0 ]
then
echo "param number "$#
PATH="./"
if (( $# == 1))
then
PATH=$1
fi
if [ -d ${PATH} ]
then
echo "MYPATH= "${PATH}
/usr/bin/find ${PATH} -maxdepth 1 -type f -name "*.sh" | /usr/bin/xargs -I FL /usr/bin/dos2unix FL
else
echo ${PATH}" is not a directory."
fi
else
echo "param number wrong. "$#
fi
调用方式:
shell2unix.sh /cygdrive/d/work/myproject_name