4

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 it's called from command line with a URL as an argument, everything works well. But if I specify the script in the configuration of urxvt, then no URL is passed (I'm checking logurls for that).

The configuration for urxvt is

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

the weirdest thing is that if I change urlLauncher to /usr/bin/firefox - then it opens the URL somehow. So looks like the URL is passed to firefox but not passed to my script.

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

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

birac
  • 568
  • 1
  • 8
  • 18
jdevelop
  • 12,176
  • 10
  • 56
  • 112

0 Answers0