I know I can open a SpatiaLite database and export a CSV from it as the following:
.headers on .mode csv .output csvFile.csv select * from table .output stdout
However, I'd like to automate the process of exporting CSV files from SpatiaLite with a bash script. Is there any way to execute this same sequence of commands from a shell? Just so I don't need to manually enter the database all the times I want to export data from it?
Alternatively, is there any way of exporting the result of a query inside my SpatiaLite database to a csv file directly? Without the need of using the commands that I used in my example?