« October 26, 2004 | Main | October 30, 2004 »

October 29, 2004

Using wget to download a URL stored in the clipboard

Here is an alias used to quickly download a link using wget:

alias cget 'pbpaste | wget -i -'

pbpaste is a Mac OS X only command line utility that prints the clipboard to the standard output. wget’s -i option tells it to read URL(s) from a file, and - makes it use the standard input in place of a file.

To use it, copy a URL, open a new Terminal window and type cget. Download should begin, with all of wget’s great features like perseverence and robustness.

This technique will be improved in an upcoming article has been used by yours truly for almost a year and a half without feeling the need for improvement.

Do not meddle in the affairs of Coding Ninjas, for they are subtle and quick to anger.