B2G/build/envsetup.shの内容
envsetup.sh 1051 if [ "x$SHELL" != "x/bin/bash" ]; then 1052 case `ps -o command -p $$` in 1053 *bash*) 1054 ;; 1055 *) 1056 echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results" 1057 ;; 1058 esac 1059 fi$ echo $SHELL /bin/bashどうして、頭にxがついているんだろう? $ test $SHELL != "/bin/bash"; echo $? <=とくに変わらない 1 $ test "x$SHELL" != "x/bin/bash"; echo $? <=とくに変わらない 1 $ test "a$SHELL" != "x/bin/bash"; echo $? 0$ ps -o command COMMAND /bin/bash ps -o command bash$ echo $$ <= 自分のPID 10028$ ps -p $$ PID TTY TIME CMD 10028 pts/1 00:00:00 bash
1060 # Execute the contents of any vendorsetup.sh files we can find. 1061 for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null` fは、”device/samsung/maguro/vendorsetup.sh device/ti/panda/vendorsetup.sh”になる。 1062 do 1063 echo "including $f" 1064 . $f <=各vendorsetup.shを実行する。 1065 done 1066 unset f$cd B2G G$ /bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh /bin/ls: vendor/*/vendorsetup.sh にアクセスできません: そのようなファイルやディレクトリはありません /bin/ls: vendor/*/*/vendorsetup.sh にアクセスできません: そのようなファイルやディレクトリはありません device/samsung/maguro/vendorsetup.sh device/ti/panda/vendorsetup.sh <=これがfになる。$ cd B2G/device/samsung/maguro $ cat vendorsetup.sh add_lunch_combo full_maguro-userdebug$ cd B2G/device/ti/panda $ cat vendorsetup.sh add_lunch_combo full_panda-eng$ lunch You're building on Linux Lunch menu... pick a combo: 1. full-eng 2. full_x86-eng 3. vbox_x86-eng 4. full_maguro-userdebug <= 増える 5. full_panda-eng <= 増える Which would you like? [full-eng]
envsetup.sh 1067 1068 addcompletions envsetup.sh 198 function addcompletions() 199 { 200 local T dir f 201 202 # Keep us from trying to run in something that isn't bash. 203 if [ -z "${BASH_VERSION}" ]; then 204 return 205 fi 206 207 # Keep us from trying to run in bash that's too old. 208 if [ ${BASH_VERSINFO[0]} -lt 3 ]; then 209 return 210 fi 211 212 dir="sdk/bash_completion" 213 if [ -d ${dir} ]; then <= B2G/sdkフォルダがないのでエラーになる? 214 for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do 215 echo "including $f" 216 . $f 217 done 218 fi 219 }$ echo $BASH_VERSION 4.2.24(1)-releasebash-completionとは
通常bashでは、TABキーを押すことで、ファイル名の補完が行えます。
bash-completionはこの機能を拡張し、例えば sshコマンド時のホスト名等を補完したりすることが出来ます。
実行すると以下のように表示される。 $ . build/envsetup.sh including device/samsung/maguro/vendorsetup.sh including device/ti/panda/vendorsetup.sh