分类: LINUX
2008-06-13 19:37:40
# # 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 } |