Skip to content

Instantly share code, notes, and snippets.

@Konfekt
Last active May 8, 2020 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Konfekt/ebad84e99695905d9613ce215034b748 to your computer and use it in GitHub Desktop.
Save Konfekt/ebad84e99695905d9613ce215034b748 to your computer and use it in GitHub Desktop.
kc-sms - send SMS using KDEconnect on the command line
#!/bin/sh
if ! command -v kdeconnect-cli >/dev/null 2>&1; then
echo "kde-connect-cli not found! Please install KDE Connect."
exit 1
fi
if [ $# -eq 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then
echo "kc-sms - send SMS using KDE Connect on the command line"
echo "usage: kc-sms <Phone Number> <Message> [Parameters]"
echo "example: kc-sms 01721234567 'How are you?' --refresh"
exit 2
fi
name="$(kdeconnect-cli --list-available --name-only | head -n 1)"
if kdeconnect-cli --name "$name" --destination "$1" --send-sms "$2" "${@:3}"; then
echo "successfully sent SMS to $1 by phone $name"
else
echo "error sending SMS to $1 by phone $name"
fi
@Konfekt
Copy link
Author

Konfekt commented May 8, 2020

This blog entry explains this little script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment