Shell script to open a link in the current browser with urxvt click

I have a simple shell script:

#!/bin/zsh URL=$1 function findBrowser { processName=$1 ps ax | grep "$processName" | grep -v grep | wc -l } CNTFF=`findBrowser "firefox"` CNTCH=`findBrowser "chromium"` echo "$*" > $HOME/logurls if [ $CNTFF -ge 1 ] then /usr/bin/firefox "$URL" elif [ $CNTCH -ge 1 ] then /usr/bin/chromium "$URL" else echo "No running browser instance" fi 

if he called the url from the command line as an argument, everything works fine. But if I specify the script in the urxvt configuration, then no URL will be passed (for this I check logurls).

Configuration for urxvt -

 URxvt.perl-ext-common: default,matcher,clipboard URxvt.matcher.button: 1 URxvt.urlLauncher: $HOME/bin/openurl 

The strangest thing is that if I change urlLauncher to / usr / bin / firefox, it will somehow open the URL. It looks like the URL is passed to firefox, but not passed to my script.

What is the way to debug? Or am I missing something about urxv?

the update works well if I specify / home / user / bin / openurl instead of $ HOME / bin / openurl

+4
source share

All Articles