将指定目录下sh脚本全部转换成unix格式。

来源:互联网 发布:程序员的修行 编辑:程序博客网 时间:2024/06/05 17:07

将指定目录下sh脚本全部转换成unix格式。

dos2unit     xx.sh

写个脚本:

shell2unix.sh

#!/bin/bashif [ $# == 1 ]  || [ $# == 0 ] thenecho "param number "$#PATH="./"if (( $# == 1))thenPATH=$1fiif [ -d ${PATH} ]thenecho "MYPATH= "${PATH}/usr/bin/find ${PATH} -maxdepth 1 -type f -name "*.sh" | /usr/bin/xargs -I FL /usr/bin/dos2unix FLelseecho ${PATH}" is not a directory."fielseecho "param number wrong. "$#fi

调用方式:

shell2unix.sh     /cygdrive/d/work/myproject_name

0 0
原创粉丝点击