> On 5 Nov 2015, at 10:13pm, Yuri <yuri at rawbw.com> wrote:
> 
> In my case script is like this:
> #!/bin/sh
> (cat $1 && echo ";") | sqlite3 my-db.sqlite
> 
> Command to run it:
> ./my-sql-run sqls/my-query.sql
> 
> I need to pass some parameter, like "select * from table where 
> kind=%%MYPARAM%%"

Use echo or to put the command you want into a text file and feed that text 
file to sqlite3:

sqlite3 my-db.sqlite < commands.txt

Alternatively make your command file with the variable in, then use the 'sed' 
command to replace the parameter with your desired value.

sed -i '.bak' 's/%%MYPARAM%%/17/g' commands.txt
sqlite3 my-db.sqlite < commands.txt

Simon.

Reply via email to