Question

I'm working on configuring the iTerm terminal emulator for the Mac to do what I want. Apparently everything is done through what they call "bookmarks." OK, fine. I'm trying to create a bookmark that will open a tab, cd to a certain Rails project, and run the command script/server. What's supposed to happen is that this will launch the server daemon ("Mongrel") and I'll see the output scrolling by every time I look at that tab.

In the config dialog, under "command" I put script/server and under "working dir" I put the project directory.

What happens is that the tab appears for 1/10th of a second then vanishes.

Recalling a similar problem I had with the Unix screen command, I tried putting a "command" of bash -c 'script/server' but the result was identical.

Was it helpful?

Solution

You're running into that problem because your script runs and then terminates. All you need to do is put a read or something equally sophisticated to say "Press any key to complete script and close window...." at the end of the script.

update

I wrote this test script:

$ cat echoscript 
#!/bin/bash
echo "Hello world"
read text
$ 

I created a bookmark so:

name: test
command: /Users/chasrmartin/echoscript
Working directory: /Users/chasrmartin

When I open the bookmark test, I see my "Hello world", and it waits until I type return. When I type return, it goes away.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top