Welcome to the Linux Foundation Forum!

How to pass a bash variable to xdg-open?


I'm using bash pass to store my passwords. But it seems to break up URLs of the form ''email/https://www.mymailprovider.com/login'' into a directory tree structure. I've written a hacky script to replace the box drawing characters with "/" and store the URL in a variable. If I cut-and-paste the URL into xdg-open it works fine. But I can't find a way to pass the variable containing the URL into xdg-open:

Here's the script---a work-in-progress:


BLIP=$(pass email)

WORD2=$(echo $BLIP | awk '{print $3}')
WORD3=$(echo $BLIP | awk '{print $5}')
WORD4=$(echo $BLIP | awk '{print $7}')

xdg-open '$URL'

echo $URL
# xdg-open https://www.fastmail.com/login

# xdg-open echo $URL

No doubt there's a better way.

Many thanks,



  • fcioanca
    fcioanca Posts: 1,966

    Hi @lrprentice ,

    I believe you are posting this in the wrong forum. If it is related to a course, please post it in the appropriate forum.


  • lrprentice

    Please, tell me the correct forum and how I access it. I've spent two hours trying to understand how to respectfully post my question on two different forums--including The Linux Foundation forum. Am I stupid or are the interfaces lacking something?

    Thank you,


  • fcioanca
    fcioanca Posts: 1,966

    Are you taking a specific training course from the Linux Foundation and this post is related to that? If so, you will need to post in the course forum. If this is not related to a course, your post does not belong in this forum.


Upcoming Training