Women in Technology

Hear us Roar

  PHP with Apple's Developer Tools
Subject:   Using 'open'
Date:   2002-11-29 09:21:56
From:   anonymous2
The /usr/bin/open command defaults to using either a Finder creator or the file's extension (if the Creator isn't set in the desktop database) to decide which application to invoke. This can be a pain for files with extensions other than those that are in Project Builder's plist.

Fortunately, open has a -a switch that allows you to specify the application. For example:

open -a /Developer/Applications/Project\ Builder.app somefile.php

will open somefile.php in Project Builder. I do this so often that I have an alias in my .rc file:

alias openpb 'open -a /Developer/Applications/Project\ Builder.app'

One can use a similar trick for opening files in BBEdit (yes, I have an 'openbb' alias as well) or just about any other editor you want to use (so long as the editor responds to the Open AppleEvent).

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Using 'open'
    2002-12-04 07:20:58  charlesa1 [View]

    With open(1), you don't need the full path to your application, so...

    open -a Project\ Builder

    .. will work just fine.

    And with BBEdit, you don't need to define an alias, just install and use the bbedit(1) command-line tool provided by Bare Bones. It includes a number of helpful switches for doing things like creating or printing a file, leaving BBEdit in the background or waiting until BBEdit is done with the file (so you can almost use it as an $EDITOR replacement).