用enca检查文件编码的shell

Standard
#!/bin/bash
go()
{
 tmp=`find $1 -name "*.$2"`
 path=( ${tmp} )
 for((i=0;i<${#path[@]};i++));do
  encode=`enca -L none ${path[${i}]} -e`
  if [[ $encode == ASCII* ]]
  then
   echo $encode : ${path[${i}]}
  fi
 done
}
go `pwd` php
go `pwd` phtml
go `pwd` js
go `pwd` css
go `pwd` yemaosheng.com

转载请注明出处 http://yemaosheng.com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.