69 points · by snihalani · 14y ago · 15 comments
`open -a Mail mydoc.pdf` (open Mail and create a Mail with attachment mydoc.pdf)
is my favorite line of Mac shell magic ever.
#!/bin/bash
man -t $@ | ps2pdf - | open -fa Preview
it opens a man page formatted as a PDF in PreviewThis opens the current directory in finder. I use this one all the time.
This may not work as intended in cases where a command has the same name as a function. The nicely recursive 'man man' will tell you how to work around that.
do shell script "my script"
Despite being an obnoxious language, AppleScript is pretty handy for distributing shell scripts onto non-technical users' machines.In two minutes I made a quick and dirty system wide workflow to download the selected URL.