变量$REPLY是'read'命令结果保存的默认变量
2011-11-15 23:50
281 查看
#!/bin/bash select item in one two three four five do if [ ! -z "$item" ];then echo "Your chose option number $REPLY while is \"$item\"" else echo "$REPLY is not valid." fi done
[root@bogon script]# ./select1.sh 1) one 2) two 3) three 4) four 5) five #? 1 Your chose option number 1 while is "one" #? 3 Your chose option number 3 while is "three" #? 4 Your chose option number 4 while is "four" #? 7 7 is not valid. #? [root@bogon script]#
相关文章推荐
- windows linux 使用python执行系统命令并将结果保存到变量
- makefile中使用shell命令并将结果保存为变量
- Unix Shell编程——将命令输出结果保存到变量中
- 将windows命令行的结果保存到文件 (cmd命令的重定向输出)
- 【vim】在vim中将unix命令执行的结果保存在vim文件中
- Linux shell 命令多行结果赋值给变量
- shell 十进制数字转十六进制字符串并将结果保存到变量
- 利用plsql developer的命令或isqlplus将查询结果保存到文件中
- dos批处理如何把hostname命令的结果可在到变量
- [汇编语言]sub命令得到的结果,在送入内存之前,是否保存在某个寄存器中
- linux 下c/c++ 使用shell命令并加入参数、保存结果
- 将shell命令保存为一个变量
- bash 脚本编程七 将命令输出保存到变量中(转载)
- 如何将linux 命令的执行结果在屏幕输出的同时保存到文件
- 保存cmd命令运行结果
- 如何将DOS下执行命令的结果信息保存到一个文件
- python 调用系统命令,并将输出重定向,输出其结果至文件或者字符串变量
- oracle之存储过程5-查询结果保存到变量中去
- sqlite3 执行命令 显示结果 插入图片 保存图片 例子
- 1. 设置环境变量 HISTSIZE , 使其能够保存10000条命令历史。