0

I need to create a bash script that checks the Epiphany's browser history and if the last URL visited is 192.168.8.1 then redirect to another URL. So, the Epiphany's browser history is shown in the following file:

/home/pi/.config/ephy-history.db

It's a database file.

How can I check the ephy-history.db file from a bash script?

This should the query to check the last URL (title) visited:

select title from urls where last_visit_time in (select max(last_visit_time) from urls);
  • Is it a mysql database? – NULL Mar 17 '17 at 13:46
  • Not sure what kind of db is. I think I can use this on the bash script: sqlite3 /home/pi/.config/ephy-history.db select title from urls where last_visit_time in (select max(last_visit_time) from urls); – Rodrick Mar 17 '17 at 13:54
  • You are going to need to use the sqlite3 program inside your script to check for what you want. This is not really related to Raspberry Pi though. – NULL Mar 17 '17 at 18:15
0
S1="Tittle of the web I want to show"
S2=$(sudo sqlite3 "/home/pi/.config/ephy-history.db" "select title from urls where last_visit_time in (select max(last_visit_time) from urls);")

if [ "$S1" = "$S2" ]; then
        echo "do nothing"
else
        echo "close the last tab opened in the browser"
        xte "keydown Control_L" "keydown w" "keyup Control_L" "keyup w" -x:0
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.