Running a Sqlite3 Script from Command Line

后端 未结 4 1443
孤街浪徒
孤街浪徒 2020-12-29 05:12

I am writing a shell script to scp a project and part of it involves transferring some important tables in my database.

I have the following stored in the file

4条回答
  •  粉色の甜心
    2020-12-29 05:36

    The parameter you give to the sqlite3 program is the database file name.

    To execute commands from a file, you must redirect the input to that file:

    $ sqlite3 mydatabase.db < SQLTableTransfer
    

    or tell it to read from that file:

    $ sqlite3 mydatabase.db ".read SQLTableTransfer"
    

提交回复
热议问题