I have a script that reads a Qubes bookmarks file. It works if placed in the Qube. But I would like to make it work for from dom0 by passing Qubes name param. How would I do that?
Relevant code:
bookmarks_file='/home/user/.config/BraveSoftware/Brave-Browser-Nightly/Default/Bookmarks'
scan_bookmarks_file(){
#$1=scan text
local bm_name=''
local bm_url=''
local get_url=false
while IFS= read -r line; do
# Limit max matches.
if [ ${#matched_bookmarks[@]} -eq $max_bookmarks_match ]; then break; fi
# Store the name entry to be used if URL match is found later.
if [[ "$line" == *"name"* ]]; then
local last_name_entry="$line"
fi
# Look for match in name.
if [[ "$line" == *"name"* && "${line^^}" == *"${1^^}"* ]]; then
local get_url=true
local bm_name=$(parse_name "$line")
# No match in name found. Look for match in URL
elif [[ "$line" == *"url"* && "${line^^}" == *"${1^^}"* ]]; then
local get_url=false
local bm_name=$(parse_name "$last_name_entry")
local bm_url=$(parse_url "$line")
update_matched_booksmarks "$bm_name" "$bm_url"
fi
# Matched name already found. Get the next URL.
if [[ "$line" == *"url"* && get_url == true ]]; then
local get_url=false
echo "**** RUL line:$line"
local bm_url=$(parse_url "$line")
update_matched_booksmarks "$bm_name" "$bm_url"
fi
done < $bookmarks_file
}