aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-11-06 17:09:50 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-11-06 17:09:50 +0100
commit42b4dd8a0319a8828e6aea97b847ed554d22f15e (patch)
treec3649f1b3a17455bcf7aa4e30469aa2be39c9823
parent2ab348bf85808d296cf74c7e7d5e402defb85e5b (diff)
downloadscripts-42b4dd8a0319a8828e6aea97b847ed554d22f15e.tar.gz
scripts-42b4dd8a0319a8828e6aea97b847ed554d22f15e.zip
Created monospace whatsapp message clipboard utility.
-rwxr-xr-xwa.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/wa.sh b/wa.sh
new file mode 100755
index 0000000..39ac46f
--- /dev/null
+++ b/wa.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# wa.sh
+#
+# Usage: wa.sh
+#
+# Passes input to clipboard surrounded by Whatsapp's
+# monospace macro lines.
+#
+# wa.sh uses 'cat -' to process input, so standard
+# input is read if no input is provided.
+
+if ! type xsel >/dev/null; then
+ echo "xsel not found: wa.sh depends on xsel." 1>&2
+ exit 1
+fi
+
+echo '```' | xsel -bi
+cat - | xsel -ba
+echo -n '```' | xsel -ba