Here’s a feature I wasn’t aware of, thanks to MacOSXHints.com. The open command (man page) provides a -f option, which open‘s own help says “Reads input from standard input and opens with TextEdit”. But, in fact, you can load the data into nearly any application. Simply combine the -f flag with the -a flag:
- curl 'http://example.com/example.html' | open -a 'TextMate' -f
- curl 'http://example.com/example.png' | open -a 'Preview' -f
I usually don’t bother using the open command with TextMate; I simply use the command line tool, which can read from standard input:
- ps -ax |mate
BBEdit can do the same.