Skip to content

Instantly share code, notes, and snippets.

@ybonnel
Forked from dgageot/twitter_say.sh
Created May 28, 2012 18:42
Show Gist options
  • Save ybonnel/2820598 to your computer and use it in GitHub Desktop.
Save ybonnel/2820598 to your computer and use it in GitHub Desktop.
Say each tweet when it arrives
#!/bin/bash
lines_to_skip=`t timeline | wc -l | sed 's/^ *//g'`
i=0
echo Skipping [$lines_to_skip] lines in the timeline
echo From now on, say each tweet as soon as it arrives...
t stream timeline | while read -r line; do
i=`expr $i + 1`
if [ $i -ge $lines_to_skip ]; then
echo "$line"
# Substitute RT by Reuh Twitte to have good voice
line=`echo $line | sed "s/RT /Reuh Twitte /"`
# Substitute tweet by twitte to have good voice
line=`echo $line | sed "s/tweet/twitte/"`
# Delete of links
line_final=""
for mot in $line
do
HTTP_FIND=`echo $mot | grep 'http://' | wc -l`
HTTPS_FIND=`echo $mot | grep 'https://' | wc -l`
if [ $HTTP_FIND -eq 0 -a $HTTPS_FIND -eq 0 ]
then
line_final="$line_final $mot"
fi
done
say -v Sebastien "$line"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment