> I was asking whether it is possible to use Shebang with sqlite script.
> If it is possible, would you please show me how to modify the
> following script to do so?

If you don't mind one error message then you can do it like this:

> cat test.sql
#!/usr/bin/sqlite3 -init
;
create table tbl1(one varchar(10), two smallint);
.h on
pragma table_info('tbl1');
.quit
> ./test.sql
-- Loading resources from ./test.sql
Error: near line 1: unrecognized token: "#"
cid|name|type|notnull|dflt_value|pk
0|one|varchar(10)|0||0
1|two|smallint|0||0
>

Otherwise it's impossible to it because '#' is not a comment-starting
symbol in sqlite command line utility.


Pavel

On Thu, Jun 24, 2010 at 10:13 AM, Peng Yu <pengyu...@gmail.com> wrote:
> On Thu, Jun 24, 2010 at 5:05 AM, Simon Slavin <slav...@bigfraud.org> wrote:
>>
>> On 24 Jun 2010, at 4:50am, Peng Yu wrote:
>>
>>> Is there a way to use Shebang for sqlite3 script?
>>>
>>> http://en.wikipedia.org/wiki/Shebang_%28Unix%29
>>
>> SQLite comes with a command-line tool.  You can feed it with individual 
>> commands on a Unix command-line or tell it to read commands from a file.
>
> I was asking whether it is possible to use Shebang with sqlite script.
> If it is possible, would you please show me how to modify the
> following script to do so?
>
> $ ./main.sql
> Error: unknown command or invalid arguments:  "/main.sql". Enter
> ".help" for help
> $ cat main.sql
> #!/usr/bin/sqlite3 main.db
>
> create table tbl1(one varchar(10), two smallint);
> .quit
>
>
> --
> Regards,
> Peng
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to