Page 1 of 1
Xterm and commands
Posted: Sat Aug 20, 2005 5:48 am
by Neo
I was trying to open a new xterm window and run a command in it (the ls as a test)
I did the following
but all I see is a xterm flashing off really fast.
So does anyone know how to open an xterm and execute a few commands there
and keep the new xterm alive still?
Re:Xterm and commands
Posted: Sat Aug 20, 2005 9:19 am
by JoeKayzA
The reason why it's gone so fast is that it waits for all sub-processes to finish, and then terminates. "ls" probably finishes _very_ fast, so you only see a short flash...
You could do this instead:
This way the first command will be executed, and then you'll get an interactive shell. When this one is finished then (e.g. you type "exit" in it), xterm will terminate.
I know this is not an elegant solution, but it works.
cheers Joe
Re:Xterm and commands
Posted: Sat Aug 20, 2005 9:26 am
by Neo
Yup, thanks a lot Joe, that does work.
@ all: Is there a more elegant way to do it or is that the only way?
Re:Xterm and commands
Posted: Sun Aug 21, 2005 1:37 am
by Neo
I wanted to run a script to log me into another machine and then use the xterm, but after the bash shell appears I have to type in the script name to continue.
Is there any way to do this?
Re:Xterm and commands
Posted: Sun Aug 21, 2005 2:13 am
by JoeKayzA
Well, that's because as soon as execution reaches the "sh", it blocks and waits for input from the user. Assuming you do the following now:
it would mean you wait for the script to terminate and then open a _local_ shell. I suspect you'll have to modify the script that it doesn't terminate and instead waits for your input. What does it look like?
cheers Joe
Re:Xterm and commands
Posted: Sun Aug 21, 2005 7:43 am
by Neo
Thanks a lot it works now. I modified the script to get input at the end at it works.