3

Can't figure this one out, if I execute the command directly in the shell, then it executes successfully, but running from a script file I get the following error:

sqlite3: Error: too many options: "INTO"

#!/bin/bash
sql="\"INSERT INTO keys ('date','chan','key','name','desc','ser','ep','cat') VALUES('xxx','xxx','xxxx','xxxx','xxxxx.','xxx','xxx','xxxx');\""      
echo $sql
sqlite3 mydb.db $sql

Any ideas on what the problem might be ?

2
  • Double quote the $sql variable in the script: sqlite3 mydb.db "$sql" Commented Oct 14, 2013 at 1:07
  • @h3nr1x Please make that an answer. Commented Oct 14, 2013 at 8:26

2 Answers 2

2

Double quote the $sql variable in the script:

#!/bin/bash
sql="\"INSERT INTO keys ('date','chan','key','name','desc','ser','ep','cat') VALUES('xxx','xxx','xxxx','xxxx','xxxxx.','xxx','xxx','xxxx');\""      
echo $sql
sqlite3 mydb.db "$sql"
Sign up to request clarification or add additional context in comments.

Comments

0

In my case the problem was in the binary I execute:

cat  /opt/sbin/sqlite3:
#!/bin/sh
export LD_LIBRARY_PATH="/opt/lib:$LD_LIBRARY_PATH"
/opt/sbin/sqlite3.real $@

So if I execute /opt/sbin/sqlite3.real I have no problems.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.