在windows平台上使用source insight开发时,常常会有文件格式的问题,我们知道dos2unix可以完成从dos格式到unix格式的转换,但是最好能够有一个现成的批量转换脚本。

#!/bin/sh
foreachd () {
  echo $1
  for file in $1/*
  do
    if [ -d $file ]
    then
      echo "directory $file"
      foreachd $file
    fi

    if [ -f $file ]
    then
      echo "file $file"
      dos2unix $file
      chmod -x $file
    fi

  done
}

echo $0
a=`echo $1`
if [ $# -gt 0 ]
then
  foreachd $a
else
  foreachd "."
fi

使用方法:
dos2unix.sh [path]

相关文章:

  • 2021-11-30
  • 2021-12-10
  • 2021-09-21
  • 2021-10-22
  • 2021-11-26
  • 2022-12-23
猜你喜欢
  • 2021-09-07
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2021-09-21
相关资源
相似解决方案