#!/bin/sh IFS='%' MATCHES='^gopher://,dillo%^http(s)?://.*(youtube|libsyn|podtrac)\.com,mpv%\.(ogg|mp4|mp3|ogv|webm)$,mpv%^https?://,firefox%\.(jpg|png|jpeg)$,qiv%\.rom,uxnemu%.*$,emacsclient -c' for item in $MATCHES; do echo "$@" | egrep -e "$(echo $item | cut -d ',' -f 1)" if [[ $? == 0 ]]; then command=$(echo $item | cut -d ',' -f 2) exec eval "$command $@" fi done .