dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit be755c836832240049a197c073206fe6456e3273
parent a56b6bd72127460203aa7df5ef53eefbd5ecd749
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon,  9 Mar 2020 14:28:20 +0100

Fix input handling in sendtext script

Diffstat:
M.local/bin/sendtext | 34+++++++++-------------------------
1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/.local/bin/sendtext b/.local/bin/sendtext @@ -10,20 +10,9 @@ show_help() { echo "(e.g. +45xxyyxxyy), or known aliases." echo echo "OPTIONS are one or more of the following:" - echo " -h, --help show this message" - echo " -v, --version show version and license information" - echo " -- do not consider any following arguments as options" - -} - -show_version() { - echo "${0##*/} version $version" - echo "Licensed under the GNU Public License, v3+" - echo "written by Anders Damsgaard, anders@adamsgaard.dk" - echo "https://src.adamsgaard.dk/dotfiles" + echo " -h show this message" } - die() { printf '%s\n' "$1" >&2 exit 1 @@ -43,21 +32,10 @@ send_twilio_text() { while :; do case "$1" in - -h|-\?|--help) + -h) show_help exit 0 ;; - -v|--version) - show_version - exit 0 - ;; - --) # end all options - shift - break - ;; - -?*) - die 'error: unknown option specified' - ;; *) # no more options break esac @@ -72,5 +50,11 @@ fi authstring="$(pass Online/twilio-account-sid):$(pass Online/twilio-auth-token)" message="$(cat)" for r in "$@"; do - send_twilio_text "$(pass Telephone/$r)" + case "$r" in + +[0-9]*) + to="$r";; + *) + to="$(pass Telephone/$r)" + esac + send_twilio_text "$to" done