分类:
2012-03-16 16:56:53
原文地址:vivi情景分析(一): 配置管理(五) 作者:qrskc
113 # 114 # readln reads a line into $ans. 115 # 116 # readln prompt default oldval 117 # 118 #" Support OS Switching ($CONFIG_S3C2400_GAMEPARK_OSSWITCH) [Y/n/?]" "y" "y" 119 #" Support OS Switching ($CONFIG_S3C2400_GAMEPARK_OSSWITCH) [N/y/?]" "n" "n" 120 #" Support OS Switching ($CONFIG_S3C2400_GAMEPARK_OSSWITCH) [N/y/?]" "n" 121 #def $2, old $3 122 function readln () { 123 if [ "$DEFAULT" = "-d" -a -n "$3" ]; then 124 #如果$DEFAULT为-d, 且$3不为空 125 #make oldconfig时,"$DEFAULT" = "-d" 126 #使用默认值(如果.config对该选项赋值了,则取该值,如没有,则取n) 127 echo "$1" 128 ans=$2 129 else 130 #make config 131 #或者arch/config.in里存在,但.config中没有的选项 132 echo -n "$1" 133 #-z空串,如果是空串则显示 134 [ -z "$3" ] && echo -n "(NEW) " 135 #以@作为分隔符,将字符串读入ans 136 IFS='@' read ans || exit 1 137 #如果ans是空串,则取默认值 138 [ -z "$ans" ] && ans=$2 139 fi 140 } |