Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
len=`echo "$*" | wc -c`
if [ $len -gt 140 ]; then
echo "Too much"
exit 1
fi
#!/bin/bash
len=`echo $3 | wc -c`
if [ $len -gt 140 ]; then
echo "Too much"
exit 1
fi
curl --basic --user $1:$2 \
--data status=$3 'http://twitter.com/statuses/update.xml' -o /dev/null;$ tw user pass 'Тест'#!/bin/bash
FILE="$HOME/.twitter"
if [! -f $FILE ]; then
echo "$FILE: does not exists."
echo «Please create this file with following contents:»
echo "[login]"
echo "[pass]"
echo «Where [login] and [pass] is your twitter login/password.»
echo «Make sure you DO NOT have an empty line in the end of file and/or spaces at start/end of the lines or authentication may fail.»
exit 1
elif [! -r $FILE ]; then
echo "$FILE: can not be read"
exit 2
fi
if [ `stat -c %a $FILE` -ne 600 ]; then
echo «WARNING: file chmod is not safe! Will try to fix.»
exec chmod 0600 $FILE
fi
LOGIN=`head -n 1 $FILE` # quick'n'dirty =)
PASSWORD=`tail -n 1 $FILE`
MSG="$*"
MSGLEN=`echo $3 | wc -c`
if [ $MSGLEN -gt 140 ]; then
echo «Too much text»
exit 3
fi
curl --basic --user $LOGIN:$PASSWORD \
--data status=$MSG 'http://twitter.com/statuses/update.xml' -o /dev/null;
MSGLEN=`echo $MSG | wc -c`
Bash и Twitter