ma-linux@calypso.tux.org
[Top] [All Lists]

[Ma-linux] Looking for an 'open' utility

Subject: [Ma-linux] Looking for an 'open' utility
From: Rob Sherwood
Date: Wed, 4 Feb 2009 17:18:49 -0800
I've been working on my Mac recently, and I've gotten quite used to
the 'open' utility which takes a file an arg and opens up that file in
a file-specific application, i.e.,


`open foo.html` will call `firefox foo.html`

`open bar.pdf` will call `acroread bar.pdf`

/usr/bin/open is not at all the right thing (it has to do with shell
i/o AFAICT).

Has anyone seen something like this or should I just implement the 5
lines of perl to write my own?

- Rob
.

--------------------
#!/usr/bin/perl -w

%assoc = {
               "HTML document text" ==> "firefox",
# more stuff


};

$file = $ARGV[0];
$type=`file $file` ;
chomp $type;
exec "$assoc{$type} $file";
_______________________________________________
Ma-linux mailing list
Ma-linux@xxxxxxxxxxxxxxx
http://calypso.tux.org/cgi-bin/mailman/listinfo/ma-linux

<Prev in Thread] Current Thread [Next in Thread>