#!/bin/sh

IFS='%'
MATCHES="gopher,gopherus%http,firefox"

for item in $MATCHES; do
   echo "$@" | grep -e "^$(echo $item | cut -d ',' -f 1)"
   if [[ $? == 0  ]]; then
       command=$(echo $item | cut -d ',' -f 2)
       exec $command $@
   fi
done