aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/scripts/yank.sh
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-07-15 21:19:53 +0200
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-07-15 21:19:53 +0200
commit42c87fb308831265bc7571bed23c47015ac9c29e (patch)
treeecc3c647e73686a0e5c00a972e9ca3a797a30dc2 /examples/data/uzbl/scripts/yank.sh
parent5db19767e101d78ee9201f01d063e43c6697dd85 (diff)
parent1b5ba5bb17152f6eb8a8f5e1f3bb46a0cd92d48b (diff)
merge in the00z his ${!8} fix for posix sh
Diffstat (limited to 'examples/data/uzbl/scripts/yank.sh')
-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"