I am making a geeklet (script that sits on the OS X desktop, from Geektool) that takes the status of unread messages from Reddit (using me.json from the API) using the command
echo
curl -X GET -u 'username:password' http://www.reddit.com/api/me.json | sed -e "s/.*\"has_mail\":
SOMEHOW GET TRUE/FALSE OF THE BOOL"
and then take the state of the bool to set an image.
Input should be either TRUE (there is an unread message) or false (there are no unread messages). Output should be an image in a local directory, changing depending on true/false.
Two Questions:
- How do you return TRUE/FALSE with sed?
- How do you take the TRUE/FALSE and set an image (locally)?
Thanks!
Sed is not the better tool to do this, try doing this :
or with grep :