aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xexamples/data/uzbl/scripts/yank.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/data/uzbl/scripts/yank.sh b/examples/data/uzbl/scripts/yank.sh
index f953ec7..376b7e2 100755
--- a/examples/data/uzbl/scripts/yank.sh
+++ b/examples/data/uzbl/scripts/yank.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# use this script to pipe any variable to xclip, so you have it in your clipboard
# in your uzbl config, make the first argument the number of the (later) argument you want to use (see README for list of args)
# make the 2nd argument one of : primary, secondary, clipboard.
@@ -6,8 +6,12 @@
# bind yurl = spawn ./examples/scripts/yank.sh 6 primary
# bind ytitle = spawn ./examples/scripts/yank.sh 7 clipboard
-which xclip &>/dev/null || exit 1
-[ "$9" == primary -o "$9" == secondary -o "$9" == clipboard ] || exit 2
+clip=xclip
-echo echo -n "${!8}" '|' xclip -selection $9
-echo -n "${!8}" | xclip -selection $9
+which $clip &>/dev/null || exit 1
+[ "x$9" = xprimary -o "x$9" = xsecondary -o "x$9" = xclipboard ] || exit 2
+
+value=`eval "echo -n \\${$8}"` # bash: value = ${!8}
+
+echo "echo -n '${value}' | $clip -selection $9"
+echo -n "'${value}' | $clip -selection $9"