Created
March 14, 2018 10:26
-
-
Save derinbay/d051b8548d468a7b7eb5b2b94d9619ec to your computer and use it in GitHub Desktop.
This file contains 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 | |
#Usage:slackpost<token><channel><message> | |
#Enterthenameofyourslackhosthere-thethingthatappearsinyourURL: | |
#https://slackhost.slack.com/ | |
slackhost=n11dev | |
token=$1 | |
if[[$token==]] | |
then | |
echoNotokenspecified | |
exit1 | |
fi | |
shift | |
channel=$1 | |
if[[$channel==]] | |
then | |
echoNochannelspecified | |
exit1 | |
fi | |
shift | |
text=$* | |
if[[$text==]] | |
then | |
echoNotextspecified | |
exit1 | |
fi | |
#escapedText=$(echo$text|sed's//\/g'|seds/'/\'/g) | |
json={\channel\:\#$channel\\n\text\:\$escapedText\} | |
curl-s-dpayload=$jsonhttps://$slackhost.slack.com/services/hooks/incoming-webhook?token=$token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment