From Nicholas Riley:
If you use shell scripts to automate OS X applications, you may need to switch between applications. You could use AppleScript via osascript(1), but it may take several seconds for the script to compile and execute--or you could use appswitch, which works almost instantly. Need to launch an X11 application from Terminal but the X server isn't in front when you need it? Use appswitch to fix the problem. Or, if you'd like a version of the ps(1) utility which understands the concept of OS X applications, appswitch can help.