Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/var/bin/mksh
- integer chars
- X="$(cat)"
- chars=$(wc -c <<<"$X")
- #print "$chars"
- if (( chars > 140 ))
- then
- pbcopy <<< " "
- print " over 140 by $(( 140 - chars ))"
- return 1;
- elif (( chars < 2 ))
- then
- pbcopy <<< " "
- print " too short!"
- return 2
- fi
- # tried with w/o case too many WTFs to/from me!
- # SO to a fav 4 me!
- case "$1" in
- ""|-) # match mothing or -
- # translate newlines to spaces
- tr '\012' ' ' <<< "$X" | pbcopy
- #print 1
- ;;
- *) # matchs anything especially "raw" or +
- pbcopy <<< "$X"
- #print 2
- ;;
- esac
- shift 2>/dev/null||exit
- #why shift? SO I CAN CUT&PASTE
- SPLAT="
- Hi"
- case "$1" in
- ""|nosave|nosave|-) # match that
- #print 3
- ;;
- *) # CATCH ALL especially "save or +
- #append tweet to daily file in /tmp/
- cat <<< "${X}$SPLAT" >> /tmp/tweetpaste.$(date '+%j')
- print 4
- ;;
- esac
- shift 2>/dev/null||exit
- #MADEWITH Obama #ASPRESIDENT
- #NOTWITH #notmypresident
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement