How to read a Qubes file from a dom0 Bash script?

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:


    #$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"

        # 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"

        # 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"
    done < $bookmarks_file

Just put it in the respective template and call it from dom0 via qvm-run.

I want it to work in all templates without having to copy to each template. Is there a way to pass the read -r command from dom0 and get the data back to dom0 without causing a security hole?