diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-11-06 22:40:48 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-11-06 22:40:48 +0100 |
commit | 8f247ce3b9cde5021e7d7d3ace8b0a486c6d1390 (patch) | |
tree | fed4e660b73df9a07f4ec095c2c4b64c208f0c10 | |
parent | 9315b5aa24f8b2dd73624932ab36bf159bf7760e (diff) | |
download | scripts-8f247ce3b9cde5021e7d7d3ace8b0a486c6d1390.tar.gz scripts-8f247ce3b9cde5021e7d7d3ace8b0a486c6d1390.zip |
wa.sh now accepts arguments as input.
-rwxr-xr-x | wa.sh | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -2,13 +2,13 @@ # wa.sh # -# Usage: wa.sh +# Usage: wa.sh [STRING]... # -# Passes input to clipboard surrounded by Whatsapp's -# monospace macro lines. +# Passes argument strings or 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. +# wa.sh without arguments 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 @@ -16,5 +16,9 @@ if ! type xsel >/dev/null; then fi echo '```' | xsel -bi -cat - | xsel -ba -echo -n '```' | xsel -ba +if [ -n "$*" ]; then + echo "$@" | xsel -ba +else + cat - | xsel -ba +fi +echo '```' | xsel -ba |