Untuk mengupdate status twitter lewat shell script sebenarnya kita hanya menggunakan HTTP request. Perintah yang digunakan adalah POST(bukan metode HTTP) atau nama lainnya lwp-request sebuah perl script yang hampir semua distribusi pasti ada. OK langusng aja lets cek it out.
Code
#!/bin/bash
#
TUNAME="User name kamu"
TUPASS="Password kamu"
TSTATUS=""
TURL="http://twitter.com/statuses/update.xml"
TDATA="source=LTME&status="
# print some fancy header :)
echo "-----------------------------------------"
echo " Twitter Status Updater"
echo " http://www.exploreyourbrain.com/"
echo "------------------------------------------"
# replace some characters ( I'm too lazy to replace all the characters :))
TSTATUS=`echo $TSTATUS | sed 's/ /%20/g'` # space => %20
TSTATUS=`echo $TSTATUS | sed 's/@/%40/g'` # @ => %40
TSTATUS=`echo $TSTATUS | sed 's/\//%2F/g'` # / => %2F
TSTATUS=`echo $TSTATUS | sed 's/:/%3A/g'` # : => %3B
TSTATUS=`echo $TSTATUS | sed 's/#/%23/g'` # # => %23
# now POST the data
echo ""
echo -n "Updating status..."
echo "${TDATA}${TSTATUS}" | POST -C $TUNAME:$TUPASS $TURL | grep $TUNAME > /dev/null
# check status
# ------------
# successfull request always return XML format that containts our username
# so we grep that to check the status
if [ $? -eq 0 ]; then
echo "DONE."
else
echo "ERROR."
fi
Ganti TUNAME dan TUPASS dengan username dan password kamu sendiri.
Simpan ke satu directory misal /home.
Beri nama tu.sh (atou terserah yang penting exkensinya .sh harus .sh okey..)
Buka terminal System » Application » Terminal atau alt+f2 » x-terminal-emulator
Masuk ke /home direktori dan berikan permission execute pada file tersebut.
[/code]
$ cd /home
$ chmod +x tu.sh
Eksekusi file tersebut, kamu akan ditanya password dan status kamu.
Code
$ ./tu.sh
Setelah itu maka status twitter kamu telah terupdate :).
click gambar untuk memperbesar..
Barangsiapa mengajarkan ilmu, maka baginya pahala seperti orang yang mengamalkan ilmu nya dan tidak akan mengurangi pahala orang yang melakukan amal tersebut.