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);
3
  • Is it a mysql database?
    – NULL
    Mar 17, 2017 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, 2017 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, 2017 at 18:15

1 Answer 1

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
1
  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Jan 7, 2020 at 23:07

Your Answer

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

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