zsh and rc file abstract
[dotfiles.git] / Scripts / plumb
1 #!/bin/sh
2
3 openlink() {
4     [ -z "$BROWSER" ] && exit 1
5     $BROWSER "$1"
6 }
7
8 link=$(echo "$2" | grep -P "https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\//=]*)") >/dev/null 2>&1
9 [ -n "$link" ] && openlink "$link" && notify-send -i "" "Opening Link: $link"
10
11
12