zoukankan      html  css  js  c++  java
  • (OK) digui-gb18030-utf8.sh——递归


    digui-gb18030-utf8.sh


    #!/bin/sh
    
    eachd() {
            for chkfile in $1/*
            do
                    if [[ -f "$chkfile" ]]
                    then
                        result=`file $chkfile |awk '{print $2}'`
                        if [ "$result" == "PHP" ]
                        then
                            #do
                            iconv -f GB18030 -t UTF-8 "$chkfile" > tmp 2>/dev/null
                            if [ $? -eq 0 ];then
                                mv tmp "$chkfile"
                            else
                                echo "$chkfile没有被转换"
                                rm tmp
                            fi
                            #done
                        fi
                    fi
    
                    if [[ -d $chkfile ]]
                    then
                            eachd $chkfile
                    fi
            done
    }
    
    #eachd "."
    
    if test -d $1
    then
        eachd $1
    elif test -f $1
    then
        echo "you input a file but not a directory,pls reinput and try again"
        exit 1
    else
        echo "the Directory isn't exist which you input,pls input a new one!!"
        exit 1
    fi
    


  • 相关阅读:
    10.11-10.16
    10.8-10.10
    9.26-28
    9.29css继承属性
    表单的学习
    排版
    css补充
    今天学的新内容
    新内容
    文本样式的修改
  • 原文地址:https://www.cnblogs.com/ztguang/p/12646838.html
Copyright © 2011-2022 走看看