run xterm -e without terminating

jarhead picture jarhead · Jun 1, 2012 · Viewed 56.8k times · Source

I want to run xterm -e file.sh without terminating.

In the file, I'm sending commands to the background and when the script is done, they are still not finished.

What I'm doing currently is:

(cd /myfolder; /xterm -ls -geometry 115x65 -sb -sl 1000) 

and then after the window pops up

sh file.sh
exit

What I want to do is something like:

(cd /myfolder; /xterm -ls -geometry 115x65 -sb -sl 1000 -e sh file.sh)

without terminating and wait until the commands in the background finish.

Anyone know how to do that?

Answer

imwilsonxu picture imwilsonxu · Nov 9, 2012

Use hold option:

xterm -hold -e file.sh

-hold Turn on the hold resource, i.e., xterm will not immediately destroy its window when the shell command completes. It will wait until you use the window manager to destroy/kill the window, or if you use the menu entries that send a signal, e.g., HUP or KILL.