android build / envsetup.sh addcompletions()“local T dir f”意味着什么?

时间:2013-04-22 08:24:01

标签: android bash build

我正在追踪Android构建系统,并发现了一些有趣的东西。

“本地T dir f”的含义是什么?

function addcompletions()
{                                                                                                                                             
    local T dir f

    # Keep us from trying to run in something that isn't bash.
    if [ -z "${BASH_VERSION}" ]; then 
        return
    fi   

    # Keep us from trying to run in bash that's too old.
    if [ ${BASH_VERSINFO[0]} -lt 3 ]; then 
        return
    fi   

    dir="sdk/bash_completion"
    if [ -d ${dir} ]; then 
        for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do
            echo "including $f"
            . $f
        done 
    fi   
}

2 个答案:

答案 0 :(得分:1)

local T dir f

bash手册中的

* 'local'           local [OPTION] NAME [= VALUE] ...      对于每个参数,都会创建一个名为NAME的局部变量      分配了VALUE。 OPTION可以是接受的任何选项      '宣布'。 'local'只能在函数中使用;它使      变量NAME的可见范围仅限于该函数      和它的孩子们。除非使用“local”,否则返回状态为零      在函数外部,提供了无效的NAME,或者NAME是a      只读变量。

* '声明'           声明[-aAfFilrtux] [-p] [NAME [= VALUE] ...]

如您所见,声明没有选项“T”。同时,在android的build / envsetup.sh中,“T”的使用方式如下:T = $(gettop),表示android源目录的顶部目录。

所以,我认为这只是一个错误。它应该是“本地dir f”

答案 1 :(得分:0)

上帝,我认为这只是变数......