Merge "Envsetup: Fix lunch choice with number in zsh"

am: 2647067ae9

Change-Id: Idf0dd8b06d00be9c5087c34b1887dcfdbee70673
This commit is contained in:
Jim Tang 2018-10-03 22:34:54 -07:00 committed by android-build-merger
commit 845a588927
1 changed files with 7 additions and 1 deletions

View File

@ -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