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.
(no subject)
I'm not positive because I haven't got anything I want run when I start up Terminal, but I believe you should be able to set what you like in the .login or the .bashrc or .tcshrc files in your ~ directory ... unless I'm misunderstanding you and you mean what code starts up a new instance of Terminal, in which case I believe that it's
/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal... yeah, that seems to do it, although I don't see how to pass parameters into it. I'm afraid all I set my Terminal to do is start the shell which offers suggested corrections for mistyped commands and so with that working I stopped investigating.
By the way, did you know you can open multiple tabs within Terminal? When I discovered that it was like the whole world changed at once.
(no subject)
Fortunately, a solution does exist (*whew*), which I just posted a link to.
I knew I could open multiple tabs in the Linux equivalent; I think I'd accidentally bumped into that in Terminal as well ... I don't use that much (despite making extensive use of tabs in web browsers), because I often want to be able to look at multiple sessions simultaneously. But since you've reminded me the feature is there, I should start looking for situations where I don't need to see everything at once, so I can use tabs to save space on my screen. (I really want about six monitors, to see everything I'm working on at once, but that'd make a laptop rather unweildy.)