aboutsummaryrefslogtreecommitdiff
path: root/wa.sh
blob: 39ac46f7a656c5c9039e070f4199a218a0bb8c4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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