| grep -Fx 'You are not allowed to create a Tweet with duplicate content.' &>/dev/null; then
# We dont output duplicate error when not in verbose mode, because it is
# is pretty easy to trigger.
- if grep -qFx -- "$post_info" ~/pdt/tweets.log; then
+ if [[ -s ~/pdt/tweets.log ]] && grep -qFx -- "$post_info" ~/pdt/tweets.log; then
if $verbose; then
echo "pdt: error: post failed. twitter and our log says this tweet is duplicate." >&2
fi
fi
done
if [[ $line ]]; then
- if grep -qFx -- "$post_info" ~/pdt/tweets.log; then
- echo "pdt: this tweet was a duplicate according to our log but unexpected was allowed."
+ if [[ -s ~/pdt/tweets.log ]] && grep -qFx -- "$post_info" ~/pdt/tweets.log; then
+ echo "pdt: this tweet was a duplicate according to our log but unexpectedly was allowed."
else
printf "%s\n" "$post_info" >> ~/pdt/tweets.log
fi
# splitting it in 2 for twitter, you could put the least important
# hash tag and the end and omit it on twitter.
#
-# Twitter considers all urls to be 23 characters. To measure the length
-# of arguments in a file, run this (replace FILE).
+# Twitter considers all urls to be 23 characters.
+#
+# To search a file of posts for any posts with longer than 280
+# characters which haven't been split with /tnt/, run the following
+# (replacing FILE with a path like /home/common/campaigns/pdt/pdt.txt).
#
# sed -r 's,/teof/.*,,;s/ *-(m|a|-dbd) [^ ]*//;s,https?://[^ ]*,https://xxxxxxxxxxxxxxx,g' FILE | awk '$0 !~ /\/tnt\// && length > 280 {print length, $0}'
#
fi
if (( ${#fails[@]} )); then
printf "%s\n" "$(tput setaf 5 2>/dev/null ||:)${_pdtsh_blocks:0:${COLUMNS:-60}}$(tput sgr0 2>/dev/null||:)"
- echo "FSF ERROR: ${fails[*]} might not have posted" >&2
+ echo "FSF ERROR: ${fails[*]} might not have posted. post text: $text" >&2
fi
}