Open data from shell in any graphical application

A sweet tip for opening data from the Mac shell environment in any graphical application from MacOSXHints.

Previous to this hint, the only way I was using “open” was to open files from the command line with their related graphical app.  For instance, opening a .rtf file in TextEdit:

open mytext.rtf

Or simply piping source code to TextMate via a curl download:

curl http://dfbills.com | mate

Now, I can can load data and files into any application by adding the -f and -a flags:


curl ‘http://example.com/encodingerror.html’ | open -a ‘Hex Fiend’ -f
curl ‘http://example.com/example.html’ | open -a ‘TextMate’ -f
curl ‘http://example.com/example.png’ | open -a ‘Preview’ -f
curl ‘http://example.com/example.m4v’ | open -a ‘QuickTime Player’ -f

Original article content:

posted in: Mac Tips Unix

You must be logged in to comment on this post (damn those spammers)

Already registered?

Username

Password

forgot password?       register