Issue
I am having issues getting this simple bash script to work. Below is the simple script which I am trying to get to work:
#!/bin/sh
adb shell sqlite3 /data/data/com.android.providers.tv/databases/tv.db "SELECT programs.title FROM programs"
I am getting the below error:
Error: near "SELECT": syntax error
If I run the command in terminal I get the correct output. I have also tried changing SELECT to select, and it is the same issue. Running manually in terminal as follows:
adb shell
sqlite3 /data/data/com.android.providers.tv/databases/tv.db
sqlite> SELECT programs.title FROM programs;
*OUTPUT*
Gives the correct output.
Does anyone have any clue what I am doing wrong?
In regards to what @Jetchisel suggested, see below for what I tried with no success:
adb shell sqlite3 /data/data/com.android.providers.tv/databases/tv.db "SELECT programs.title FROM programs;"
adb shell sqlite3 /data/data/com.android.providers.tv/databases/tv.db "SELECT programs.title FROM programs;";
adb shell sqlite3 /data/data/com.android.providers.tv/databases/tv.db "SELECT programs.title FROM programs";
Solution
It was a simple fix, see below:
#!/bin/bash
adb shell sqlite3 /data/data/com.android.providers.tv/databases/tv.db '"SELECT programs.title FROM programs;"'
Needed to add single quotes around the query.
Answered By - Ryan Burch
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.