Envsetup: Fix lunch choice with number in zsh
(zsh)$ source build/envsetup.sh; lunch 23 will result in selecting #22 because array in zsh starts from 1 instead of 0. This CL is to fix this issue. Bug: b/117202855 Test: below commands should have the same output: (zsh)$ source build/envsetup.sh; lunch 23 (zsh)$ source build/envsetup.sh; lunch aosp_walleye-userdebug Change-Id: I0570585417878bc7c73eda0e1a416232fe147fb4
This commit is contained in:
parent
9c68021f67
commit
0e3397b225
1 changed files with 7 additions and 1 deletions
|
@ -585,7 +585,13 @@ function lunch()
|
|||
local choices=($(TARGET_BUILD_APPS= LUNCH_MENU_CHOICES="${LUNCH_MENU_CHOICES[@]}" get_build_var COMMON_LUNCH_CHOICES))
|
||||
if [ $answer -le ${#choices[@]} ]
|
||||
then
|
||||
selection=${choices[$(($answer-1))]}
|
||||
# array in zsh starts from 1 instead of 0.
|
||||
if [ -n "$ZSH_VERSION" ]
|
||||
then
|
||||
selection=${choices[$(($answer))]}
|
||||
else
|
||||
selection=${choices[$(($answer-1))]}
|
||||
fi
|
||||
fi
|
||||
else
|
||||
selection=$answer
|
||||
|
|
Loading…
Reference in a new issue