Friday, May 30, 2008

Using Bash aliases to simplify the universe

I update this blog using the curl command to upload to the web server (see my entry back on March 8, 2008, "The Joy of cURL").

The command, curl -v -T TechBlog.html -u website:password ftp://ftp.freeservers.com/me/ lives in my Bash history; each time I want to upload, I simply up-arrow through the history at the command prompt until the list time appears, and then hit -enter-. Presto! Terribly easy.

But sometimes I've done a lot of command line work in the meantime (for example, python programming), so I up-arrow seventy or ninety times before the old curl command reappears.

I'm much too lazy to do that regularly.

So I created an alias in my .bashrc file: alias blog='curl -v -T TechBlog.html -u website:password ftp://ftp.freeservers.com/me/'. Now I can simply type blog instead of looking for the old curl command.

No comments: