wenchiching
wenchiching

Reputation: 485

android build/envsetup.sh addcompletions() "local T dir f" means what?

I'm tracing Android build system, and found something interesting.

What's the meaning of "local 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   
}

Upvotes: 1

Views: 302

Answers (2)

vipzrx
vipzrx

Reputation: 26

local T dir f

in the bash manual :

* 'local' local [OPTION] NAME[=VALUE] ... For each argument, a local variable named NAME is created, and assigned VALUE. The OPTION can be any of the options accepted by 'declare'. 'local' can only be used within a function; it makes the variable NAME have a visible scope restricted to that function and its children. The return status is zero unless 'local' is used outside a function, an invalid NAME is supplied, or NAME is a readonly variable.

and

* 'declare' declare [-aAfFilrtux] [-p] [NAME[=VALUE] ...]

As you can see ,there is no option "T" for declare . At the same time ,in the android's build/envsetup.sh ,the "T" is used like this: T=$(gettop) , meaning the top dir of the directory of the android source .

So , I think it is just a mistake .It should be "local dir f "

Upvotes: 1

wenchiching
wenchiching

Reputation: 485

God, I think it's just 3 variable ...

Upvotes: 0

Related Questions