Twitter da bash
June 21st, 2008 — IppatsuManUsate Twitter e da bravi nerd/geek volete utilizzarlo direttamente da bash? Ecco uno script che usa cURL:
#!/bin/bash
#
# Twitter Update
#
# Requires: cURL http://curl.haxx.se/
# By Guillermo Antonio Amaral Bastidas < gamaral@guillermoamaral.com >
#
### CONFIGURE ###
declare -rx USERNAME="YOUR_USERNAME"
declare -rx PASSWORD="YOUR_PASSWORD"
### DONT MODIFY ###
declare -x STATUS="$@"
curl 'http://twitter.com/statuses/update.xml' \
-u ${USERNAME}:${PASSWORD} \
-d "status=${STATUS}" > /dev/null 2> /dev/null
# EOF
Inserite il vostro nome utente e password nelle apposite variabili, rendetelo eseguibile con chmod u+x twitter.sh e usatelo:
./twitter.sh Frase da inviare a twitter
Uso perverso:
PROMPT_COMMAND='/path/di/twitter.sh $(history | tail -n 1)'
così potrete davvero far sapere cosa state facendo in questo momento! (Attenzione: era un geek joke, se lo capite vuol dire che ora di fare una passeggiata fuori).