I'm running Mac OS X 10.5.8 on a G4 processor.
I may or may not already have Terminal running.*
I want to double-click the icon of a text file (with
one of a particular set of filename extensions**) and
wind up with that text file open in vi inside a Terminal
window. I'm willing to have the icon I click be a
'bundle' with the target text file inside it, instead
of clicking the text file directly, if that's what it
takes. I'm pretty sure kinda sure
that if I can pop open a new Terminal window with vi
running inside it from a shell script (or a C program
that uses exec() or system()), I can get a GUI event
to invoke that. But so far, I haven't found a way to
pass startup commands to Terminal. If I were to use
xterm instead of Terminal, the trick in a script would
be
xterm -e vi {FILENAME}
but I've not found an equivalent for the Terminal app yet. Anybody out there happen to know how to do this (or know for sure that it can't be done)?
[*] Okay, I almost always have multiple Terminal
windows open, because tcsh gets lonely and I have
to keep it company (*cough*) because even with as
nice a GUI as a modern Mac, I still find the shell really,
really, really convenient for a lot of what I
do. The point is that I'm trying to initiate this
particular event from outside of Terminal and wind up
with something running inside of Terminal.
[**] Just *.abc and *.abp for now (though hey, why not extend it to *.txt and a few others once I get the basic concept working?), so it doesn't have to be able to distinguish text files from others files be peeking at their contents, just check an extension.
From the Quotation of the day mailing list, 2008-01-12:
"How the Internet might replace the newspaper as a source of information is never explained by those who assure you that it will. At present about 80 percent of all news available on the Internet originates in newspapers, according to John Carroll's estimate, and no Internet company has the resources needed to gather and edit news on the scale of the most mediocre metropolitan daily. Moreover, corporations like Google and Yahoo apparently have no interest in going into serious journalism....
"At present the Internet is basically an electronic version of the ten-year-old boy on a bicycle who used to toss the newspaper on the front porch: an ingenious circulation device."
-- Russell Baker
(submitted to the mailing list by Mike Krawchuk)
[Note that there are in fact some web-based enterprises trying to fill the reporting gap.]
Regarding last night's/this morning's question: someone on "that mailing list" with stronger Google-fu found me a script that does what I want. I still think this should have been as easy as sticking '-e' on the end of xerm is, but now that I've stashed that script in /usr/local/bin, it has been made that easy so I can stop thinking about it. Yay!
← Previous day | (Calendar) | Next day → |