#author("2025-07-07T11:12:47+09:00","","")
#mynavi()

* 目次 [#i6c5a01c]
- 関連
-- [[シェルコマンド]]
-- [[Vimメモ]]

* treeの代替 [#bd4f6451]
#html(<div class="pl10">)

#mycode2(){{
mytree(){
    indent=$1
    dir=$2
    if [ $# -lt 2 ]; then
      indent=0
      dir=$1
    else
      shift
    fi  

    if [ "$dir" == "" ]; then
        dir=`pwd`
    fi  

    while [ "$dir" != "" ]; do

        num=0
        dirs_indent=""
        while [ $num -lt $indent ]; do
            num=`expr $num + 1`
            dirs_indent="${dirs_indent}  "
        done

        if [ $indent -eq 0 ]; then
            echo "$dir"
        else
            echo "$dirs_indent"`basename $dir`
        fi  

        if [ ! -f $dir ]; then
            files="`ls -1 $dir | awk -v dir=$dir '{print dir"/"$1}'`"
            if [ "$files" != "" ]; then
                mytree `expr $indent + 1` $files
                indent=`expr $indent - 1`
            fi  
        fi          
        shift
        dir=$1
    done
}
}}

#html(</div>)


* ステップ数カウント [#yfaa435a]

// 及び /* .. */  を除外してソースステップ数をカウントする

#html(){{
<pre class="prettyprint linenums">
f=path/to/file
steps=$(sed -e '/^\s*$/d' -e '/^\s*\/\//d' -e '/^\s*#/d' -e '/^\s*\/\*/, /\*\//d' "$f" | wc -l | tr -d ' ')
echo $steps
</pre>
}}


トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS