📜 ⬆️ ⬇️

Twit. Continued.

Start.
Correcting the previous version of the script. Now I will check the response from the twitter server to make sure the message is delivered. The message itself will be received from stdin.
So, now with the help of the xsl-file twit.xsl:
<? xml version = '1.0'?>
<xsl: stylesheet version = '1.0' xmlns: xsl = 'http: //www.w3.org/1999/XSL/Transform'>
<xsl: template match = '/'>
<xsl: value-of select = 'status / id' />
</ xsl: template>
</ xsl: stylesheet>

I will check if there is a new message in the response id. Actually the script itself:
 #! / bin / sh
 # Made by rsk - http://rsk.me


 # Imports $ TPASS, $ TUSER
 .  ~ / .twit / pass
 XSLPATH = / etc / twit / twit.xsl

 echo "Type in your message ..."

 MSG = "$ (perl -e '$ _ = <>, print')"

 echo -n "Sending ..."
 RESULT = $ (curl --basic --user $ TUSER: $ TPASS --data status = "$ MSG" http://twitter.com/statuses/update.xml 2> / dev / null | xsltproc $ XSLPATH - | tail -n 1)

 if [-n "$ RESULT"];  then
 echo "ok";
 else
 echo "Sending failed!";
 fi



Do not forget about the file ~ / .twit / pass

ps article was rewritten, because Initially, the script was, to put it mildly, not optimal, which was noticed by Comrade crash

')

Source: https://habr.com/ru/post/55187/


All Articles