shp (309B)
1 #!/bin/sh 2 check() 3 { 4 regxpr=$1; 5 shift; 6 cmd=$@; 7 if echo "$str"|grep -E "$regxpr" >/dev/null; then 8 exec $cmd; 9 exit 0; 10 fi; 11 } 12 13 #str=`xclip -o` 14 15 str=$@ 16 check ".*youtube.com/watch.*" mpv $str 17 check ".*youtu.be/.*" mpv $str 18 check "^http.*" surf $str 19 check ".*\.(jpg|jpeg|png|gif)$" sxiv $str 20 echo no matches