在脚步lookup中,询问用户是否要往文件datafile添加一条记录
来源:互联网 发布:如何在知乎回答问题 编辑:程序博客网 时间:2024/05/22 02:10
答:
1 #!/bin/bash
2 #
3 #######################################
4 # Script name: lookup.bash
5 # Actor: Hua Jielong
6 # Date: 2012-06-20
7 # Script purpose: do for test
8 #######################################
9 #
10 if (( $# != 1 ))
11 then
12 echo "Usage:./lookup.bash $1" >&2
13 exit
14 fi
15
16 if [ ! -e $1 ]
17 then
18 touch $1
19 chmod +rw $1
20 fi
21
22 if [ ! -w $1 ]
23 then
24 chmod +rw $1
25 fi
26
27 if [ ! -s $1 ]
28 then
29 echo "-----$1 is a empty file-----" >&2
30 fi
31
32 echo "Do you need add new record to $1, yes or no?"
33 read answer
34
35 if [[ $answer = "yes" || $answer = "y" ]]
36 then
37 echo "Please input name tel addr birthday salary!"
38
39 echo -n "input name>"
40 read name
41
42 echo -n "input tel>"
43 read tel
44
46 echo -n "input addr>"
47 read addr
48
49 echo -n "input birthday>"
50 read birthday
51
52 echo -n "input salary>"
53 read salary
54
55 echo "$name:$tel:$addr:$birthday:$salary">>$1
56
57 cat $1|while read line
58 do
59 echo "$line"
60 done|sort -n>>tmp$$
61 mv $1 $1.bak
62 mv tmp$$ $1
63 chmod 777 $1
64
65 record=`grep -n -w $name:$tel $1`
66 echo "$record"
67 fi
- 在脚步lookup中,询问用户是否要往文件datafile添加一条记录
- 在PB中控制一条记录是否可以被修改
- 在原记录添加一条新记录
- js中询问是否要删除
- ajax判断用户是否可以增加一条记录
- C#.net 添加一行记录,在gridview中显示一条记录。添加多条记录,在gridview中显示多条记录
- Mybatis中添加一条记录返回记录主键id
- sql在一条记录(包含某字段值)中添加下一条记录中某字段值与两者差
- Oracle database datafile header中记录的datafile的大小
- 在table中添加一条斜线
- 使用AlertDialog实现使用在android中弹出对话框,询问用户是否继续执行
- C#中,关闭程序时,要求弹出对话框询问用户是否保存
- Hibernate第一课总结(往Sqlserver2000中employee表中添加一条记录)
- 第29章、向表中添加一条记录
- android添加一条短信记录
- 如何往MSSQLServer中插入一条记录
- 在FreeBSD中添加用户
- 在Ubuntu中添加用户
- 6_11_天天向上_TTYUSB0_embedded&&zigbee_1
- qt 编码
- >网站客服漂浮框架(兼容各大浏览器)
- 6_12_天天向上_TTYUSB0_embedded&&zigbee_2
- Web 开发与设计语言大盘点
- 在脚步lookup中,询问用户是否要往文件datafile添加一条记录
- 6_13_天天向上_TTYUSB0_embedded&&zigbee_3
- IOS中测量和调整UIImage到指定CGSize
- 在.net2.0中,实现对gridview删除行时弹出确认对话框的四种方法
- 在Rhythmbox中安装Google音乐插件
- Eclipse 使用指南
- php json增加积分函数
- linux登录次数限制
- SecureCRT颜色设置及上传下载数据