I\'m making a shell script to export a sqlite query to a csv file, just like this:
 #!/bin/bash
./bin/sqlite3 ./sys/xserve_sqlite.db \".headers on\"
./bin/sq         
        
You have a separate call to sqlite3 for each line; by the time your select runs, your .out out.csv has been forgotten.
Try:
#!/bin/bash
./bin/sqlite3 ./sys/xserve_sqlite.db <
instead.
You can either call your script with a redirection:
$ your_script >out.csv
or you can insert the following as a first line in your script:
exec >out.csv
The former method allows you to specify different filenames, while the latter outputs to a specific filename. In both cases the line .output out.csv can be ignored.