1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#! /bin/bash source ./util/notify source ./util/hpath get_cbd() { echo "$(xclip -o)" } end_script() { notify "$1" kill -15 $$ } url_pattern_match() { [[ "$1" != "$2"* ]] && end_script "$3" \ || echo "$1" >> "$HPATH" } url_pattern_match_cbd() { [ -z "$3" ] && cbd="$(get_cbd)" || cbd="$3" url_pattern_match "$cbd" "$1" "$2" echo "$cbd" }