shell使用sql脚本进行sqlite3数据库更新

版权声明:转载请注明出处 https://blog.csdn.net/understand125/article/details/78696850

转载请注明出处!


1. 编写sql脚本upgradeDB.sql,其中就是普通sql语句

update tablename set colname=value where ID=value;

2. 编写shell脚本

#!/bin/sh
sqlite3 -init upgradeDB.sql crane.db << EOF
.quit
EOF


说明:直接使用“sqlite3 -init upgradeDB.sql”语句会进入sqlite3命令行,需在shell中使用重定向(<< EOF),输入“.quit”退出


猜你喜欢

转载自blog.csdn.net/understand125/article/details/78696850