-
-
Save forestbaker/c4c50982408365139e6a to your computer and use it in GitHub Desktop.
Send message in telegram from bash script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 2 ]; then | |
echo "Usage: send.bash USER_NAME MESSAGE [DATA ... DATA]" | |
exit 1 | |
fi | |
USER=$1 | |
MESSAGE=$2 | |
if [ $# -ge 3 ]; then | |
DATA=$3; | |
while shift && [ -n "$3" ]; do | |
DATA="$DATA $3" | |
done | |
MESSAGE="$MESSAGE with data: $DATA" | |
fi | |
/usr/bin/telegram -k /etc/telegram/server.pub -W << AAA | |
msg $USER $MESSAGE | |
quit | |
AAA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment