title: Shell script to open a link in currently running browser with urxvt click
body: <p>I have a simple shell script:</p>
  
  <pre><code>#!/bin/zsh
  
  URL=$1
  
  function findBrowser {
      processName=$1
      ps ax | grep "$processName" | grep -v grep | wc -l
  }
  
  CNTFF=`findBrowser "firefox"`
  CNTCH=`findBrowser "chromium"`
  
  echo "$*" &gt; $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
  </code></pre>
  
  <p>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). </p>
  
  <p>The configuration for urxvt is </p>
  
  <pre><code>URxvt.perl-ext-common:  default,matcher,clipboard
  URxvt.matcher.button:   1
  URxvt.urlLauncher:      $HOME/bin/openurl
  </code></pre>
  
  <p>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. </p>
  
  <p>What is the way to debug that? Or am I missing something about urxv?</p>
  
  <p><em>update</em> it works well if I specify <em>/home/user/bin/openurl</em> instead of <em>$HOME/bin/openurl</em></p>