使用sqllie新建数据库


1 #!/bin/bash
2 sqlite3 contact.db << !
3 drop table contact;
4 create table contact (
5 name char(32),
6 address char(32)
7 );
8 insert into contact(address,name) values("jiangshang","wuxi");
9 !
10 sqlite3 contact.db<<!
11 insert into contact (address,name) values("xuhunzhen","xuxu");
12 !
13 echo 'select *from contact;'|sqlite3 contact.db|awk 'BEGIN{FS="|"} {print "N ame",$1,"Address",$2}' ;

#
!/bin/sh
sqlite3 contact.db<<!  #!与后面的!配对表示一整块
drop table contact;    #删除已有的联系表
create table contact (
name char(32),
address char(32)
);
insert into contact values ( 'test','test');
!


echo 'select * from contact;'|sqlite3 contact.db    //使用管道
原文地址:https://www.cnblogs.com/wuxi/p/2283338.html