新手问题 一个 shell 运算的语法小问题,求解答一下

kakaxi2 · October 19, 2015 · Last by kakaxi2 replied at October 19, 2015 · 1207 hits
function getTiming() {  
    start=$1  
    end=$2  

    start_s=$(echo $start | cut -d '.' -f 1)  
    start_ns=$(echo $start | cut -d '.' -f 2)  
    end_s=$(echo $end | cut -d '.' -f 1)  
    end_ns=$(echo $end | cut -d '.' -f 2)  

    time=$(( ( 10#$end_s - 10#$start_s ) * 1000 + ( 10#$end_ns / 1000000 - 10#$start_ns / 1000000 ) ))  


    echo "$time ms"  
}  

其中的 time 开始的这一行当中的10#的作用是?

用 10 进制 parse integer

#2 楼 @kakaxi2 可以 man bash 然后搜 ARITHMETIC EVALUATION

#3 楼 @luikore 恩恩,不知道有这样的官档,谢谢了

You need to Sign in before reply, if you don't have an account, please Sign up first.