[TxMt] A TextMate command to open an arbitrary PDF file

Rob McBroom textmate at skurfer.com
Thu Nov 15 18:17:30 UTC 2007

On Nov 15, 2007, at 11:04 AM, dzurn wrote:
> However, now there's arbitrary (unknown) text attached to the  
> filename, so I want to use a wildcard in this command.
> I got a suggestion to use an unquoted * as a wildcard. But if  
> AAAAis selected, this command:
> open "file:///path/to/repository/$TM_SELECTED_TEXT"*
> will open a file in Textmate named AAAA*, which is not what I want:  
> I want AAAA.pdf and AAAA-morestuff.pdfto open.

The `open` command will handle local files just fine without the  
"file://" protocol specified. This worked for me to open `textmate.pdf`:

     open "/Users/rob/Documents/Books/textmate"*

Note that the * wild-card is interpreted by the shell and the result  
is then passed to `open`. Your shell doesn't see any files named  
"file://something", so it bails. Basically, the * means nothing to  
the `open` command and "file://" means nothing to your shell. A plain  
old file path is something they both understand, which is why the  
above command works.

Rob McBroom
I didn't "switch" to Apple... my OS did.

More information about the textmate mailing list