Starting Terminal from the command line and passing an argument

Hippo Man

Hippo Man
I have a MacBook Pro running 10.5, and I have a Terminal instance set up that invokes the following command:
/usr/bin/emacs -nw
I'd like to be able to pass a file name to this instance when I start it up, so that it will open a window with an emacs session that is editing that particular file. In other words, the file name is not hard-coded, but rather, it's passed in when I start the Terminal program.

Furthermore, I'd like to be able to start this Terminal session with a specified file name by means of a command-line dialog from within another Terminal session.

Can anyone suggest a way to do this?

By the way, I'm not looking for a solution that only works with emacs, which I only mentioned here as an example. I'd like to know a general way to pass a specified argument at invocation time to an arbitrary program that's associated with a Terminal session, and I'd like to be able to perform this invocation via the command line from within another Terminal session.

Thanks in advance.
.​
 
Last edited:
I stumbled onto this thread while trying to do something similar on my Linux box. Since Mac OS X is also Unix based, following command may work:

"term -e command"

Where "command" is what you're trying to do in new terminal

I was trying to get my vim text editor to open in a new terminal. Found solution in "Unix Power Tools" from O'Reilly books. Now I aliased the command "aterm -e vim" (there's no "term" command in Linux, & aterm is my preferred terminal) so I can open a text file with "vim-new".
 
Back
Top