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:

#!/bin/bash

BLIP=$(pass email)

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

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,

LRP

Answers

  • fcioanca
    fcioanca Posts: 2,179

    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.

    Regards,

  • 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,

    LRP

  • fcioanca
    fcioanca Posts: 2,179

    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.

Categories

Upcoming Training