Shell scripting SQLite

后端 未结 2 606
滥情空心
滥情空心 2020-12-29 13:51

How do I write a shell script that displays SQLite results? I have written a script that adds an entry to the SQLite database. Now I want to display the results after adding

2条回答
  •  猫巷女王i
    2020-12-29 14:23

    One common way to solve this problem is to use a shell feature called a here document, try this:

     sqlite3 /Users/user/Documents/Test/dbName.dba <"CategoryN total = " string.

    Note that this solution allows you to create your sql DML statements pretty much as big/long as you want. For stuff that will happen regularly and it ranging over large tables, if you have permissions on our system, you may want your DML to a stored procedure and call that.

    I hope this helps.

    (If this doesn't work, please edit your post to indicate shell you are using, OS/Linux Ver and a minimal version of error messages that you are getting).

提交回复
热议问题