我正在尝试test.db
仅将架构(即无数据)转储到schema.sql
OS X中从命令行调用的文件中,而无需启动sqlite3。
我知道我可以做:
sqlite3
.open test.db
.output schema.sql
.schema
.quit
但是我不想启动sqlite3。这...
echo '.output schema.sql' | sqlite3 test.db
创建一个空文件,但这...
echo '.schema' | sqlite3 test.db
仅打印模式。如何从终端将其写入该文件?
谢谢!
Shell允许重定向,并sqlite3
可以将命令作为参数获取:
sqlite3 test.db .schema > schema.sql
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句