On 18 August 2010 22:45, Peng Yu <[email protected]> wrote:
> Hi,
>
> I'm trying to use '.read ...' along with other commands from
> command-line. But it was not successful. Could anybody let me know
> what is the correct way to do so?
>
> $ cat main.sql
> select 4;
> $ cat main.sh
> #!/usr/bin/env bash
>
> sqlite3 main.db3 'select 3; select 4;'
> sqlite3 main.db3 '.read main.sql'
> sqlite3 main.db3 'select 3; .read main.sql'
> $ ./main.sh
> 3
> 4
> 4
> 3
> Error: near ".": syntax error

Here's a thread from some time ago:
http://www.mail-archive.com/[email protected]/msg34690.html

Mixing SQL with sqlite shell meta-commands in the first command string
does not work.

So:

echo select 3;>mainplus.sql
echo .read main.sql >> mainplus.sql
sqlite3 main.db3 ".read mainplus.sql"


>
> --
> Regards,
> Peng

Regards,
Simon
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to