我正在尝试转储架构test.db
仅(即没有数据)到名为的文件中schema.sql
从 OS X 中的命令行,无需启动 sqlite3。
我知道我能做到:
sqlite3
.open test.db
.output schema.sql
.schema
.quit
但我不想启动 sqlite 3。这......
echo '.output schema.sql' | sqlite3 test.db
创建空文件,但这...
echo '.schema' | sqlite3 test.db
仅打印架构。如何从终端将其写入该文件?
Thanks!
shell 允许重定向,并且sqlite3
可以获取命令作为参数:
sqlite3 test.db .schema > schema.sql
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)