Quantcast
Channel: ubuntuclub - command line
Viewing all articles
Browse latest Browse all 3

น๊วบ#4: Script ง่ายๆ ไว้ใช้ Twitter

$
0
0

จริงๆ ก็ติดตั้งโปรแกรม twitter client ก็ได้อ่ะนะ
แต่มาทำเล่นก็สนุกดีไปอีกแบบ

ก่อนเริ่มให้ติดตั้งแพกเกจที่ชื่อ "curl"ครับ
sudo apt-get install curl

โซโล่ดีกว่า
1.สร้างไฟล์ ชื่อว่า "tweet"

gedit tweet

2.ลอก/แปะ/เซฟ/ปิด

###############################################################################

#!/bin/bash
#

USERNAME=xxxxxxx
PASSWORD=******

if [ $# != 1 ]
then
echo “Usage: ${0##*/} your tweet as you would like it to read”
exit 1
fi
tweet=$1
curl -u $USERNAME:$PASSWORD -d status="$*"http://twitter.com/statuses/update.xml>> /dev/null
echo "Your tweet has been successful posted."

###############################################################################

(อย่าลืมเปลี่ยน USER และ PASSWORD ของเราด้วยนะ)

3.เปลี่ยน atribute ให้สามารถรันได้

chmod +x tweet

4.ย้ายไปที่ชอบๆ

sudo mv tweet /usr/local/bin/

5.ทดสอบ

tweet "รับสมัครสาวก trendyteddy ชาบู ชาบู"

enter

เรียบโร้ย

ที่มา:เกลื่อนเน็ต แต่ทำเอามาจากที่นี่ครับ
http://ubuntuforums.org/showthread.php?t=881005

Trendy Teddy


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images