bash

Downloading an Image from Gravatar Using the Command Line

I am signed up for the app.net alpha, and wanted to upload my avatar picture. Unfortunately, I can't find my avatar picture anywhere on my computer.

Gravatar is a free service that allows you to save your avatar (picture) for use by multiple websites. Gravatar has a copy of the avatar I wanted, so I hoped I could just download it via the same user interface you use to upload images. It turns out that you can't do that: the user interface lets you upload pictures, but does not provide a download option. So I had to figure out how to retrieve my image the way that a Gravatar web client would.

According to the Gravatar documentation, one can get a image for a user by doing an HTTP GET with a URL of this form:

http://www.gravatar.com/avatar/HASH

where HASH is the MD5 hash of the user's email address. You can calculate this using the md5 command-line utility.

So, here is the complete command line that will calculate my MD5 hash and the retrieve the image using the curl utility:

Bash Scripting Cheatsheet

These are the half-dozen-or-so things I need to re-learn whenever I have to write a Bash script.

(And yes, I do know that the cool kids use zsh or fish instead of bash. You don't need to point that out to me.)

Good Online Resources

Snippets

Syndicate content