commit dcf661de6a15880c948948e09b99d399afbba0f2 Author: zavok <an2qzavok@gmail.com> Date: Wed, 23 Nov 2016 23:56:13 +0300 first commit Diffstat:
A | README | | | 6 | ++++++ |
A | shp | | | 19 | +++++++++++++++++++ |
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/README b/README @@ -0,0 +1,6 @@ +shp is a simple plumber. + +This script matches supplied string to a collection of regular expressions, +and launches corresponding commands. + +Use it together with xclip and hot-key. diff --git a/shp b/shp @@ -0,0 +1,19 @@ +#!/bin/sh +check() +{ + regxpr=$1; + shift; + cmd=$@; + if echo "$str"|grep -E "$regxpr" >/dev/null; then + exec $cmd; + exit 0; + fi; +} + +#str=`xclip -o` + +str=$@ +check ".*youtube.com/watch.*" mpv $str +check "^http.*" surf $str +check ".*\.(jpg|jpeg|png|gif)$" sxiv $str +echo no matches