Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dragonball05

macrumors member
Original poster
Jul 19, 2005
62
0
Hi,
I would like to figure out the analogue of the unix command: "term -e ssh"
For a Mac!!!
I can't figure out a command that, once typed in terminal, would open another terminal that would run a certain command, say ssh.
Thanks,
dragonball
 
Just some ideas as I can't think of any direct command that will do what you explicitly want, perhaps there is a cool shell script or quick app that will but I don't know of one off hand...

Idea 1) Well while this won't work in the Mac OS X native Terminal, if you have X11 installed you can use X11's terminal (xterm), and you can use the command 'xterm -e ssh whateverserver.org' just like your term command.

Idea 2) Alternately if you have X11 installed you can use the command 'open-x11 xterm' in native Mac OS X terminal and that will open an xterm in X11, though from what I can remember you can't directly send a command this way, so you would have to manually type in the command in the new window.

Idea 3) If you want to do this completely in the Mac OS X Terminal, I'm sort of at a loss so maybe someone else will know more. In this regard the only thing I can think of is perhaps making some sort of .command file for frequently used commands and then make an aliss for them so that you could just type say 'newssh' and it will connect to a specific ssh server such as...

in your .bashrc or whatever shell you use do something like this alias newssh='open ~/newssh.command'

then create a matching script command file in ~ (ex newssh.command) which contains whatever script/command you want
ie. 'ssh remoteserver.org -l me'

then all you would need to do is type 'newssh' at the command prompt and it will open an ssh connection to remoteserver.org as user me.

The only downside with this is that if say you run a quick command this way, such as 'ls -la' or something, once the command is executed it will imediately exit, though perhaps maybe you could somehow dump to a command line though I'm not quite sure off hand how you would code that.


So in the end probably not what you exactly wanted but just thought I'd throw them out there.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.