分类:
2012-03-16 16:46:21
原文地址:vivi情景分析(一): 配置管理(四) 作者:qrskc
# # bool processes a boolean argument # # bool question define # #bool ' Support OS Switching' CONFIG_S3C2400_GAMEPARK_OSSWITCH function bool () { #将$CONFIG_S3C2400_GAMEPARK_OSSWITCH的值赋给old #eval:再次执行命令行处理,相当于执行两次eval #如a=1 #A1=666 #echo \$A$a #$A1 #eval echo \$A$a #666 ōld=$(eval echo "\${$2}") #如果old有值,则采用old的值,否则为n def=${old:-'n'} case "$def" in "y" | "m") defprompt="Y/n/?" def="y" ;; "n") defprompt="N/y/?" ;; esac while :; do #" Support OS Switching ($CONFIG_S3C2400_GAMEPARK_OSSWITCH) [Y/n/?]" "y" "y" #" Support OS Switching ($CONFIG_S3C2400_GAMEPARK_OSSWITCH) [N/y/?]" "n" "n" #" Support OS Switching ($CONFIG_S3C2400_GAMEPARK_OSSWITCH) [N/y/?]" "n" readln "$1 ($2) [$defprompt] " "$def" "$old" #根据ans进行赋值 case "$ans" in [yY] | [yY]es ) define_bool "$2" "y" break;; [nN] | [nN]o ) define_bool "$2" "n" break;; * ) help "$2" ;; esac done } |