n0t313 n0t313 - 4 years ago 115
Bash Question

shell script - open xterm window execute command and keep on executing script

Im writing a shell script and i need my script to open a xterm window run a command and without closing the xterm proceed with the script.

The code is basically a huge case for a menu.

This is an example of my script

...
example() {
echo -n "thingy > "
read thingy
echo -n "thingy1> "
read thingyl
xterm -hold -e *el command*
menux
}
...


Problem:

The script opens xterm executes the command and keeps the window open but wont continue the script and if i press ctrl + c it goes back to the shell

Answer Source

This change

nohup xterm -hold -e *el command* &

May do what you want. The nohup tells the shell not to send the HUP (1) signal to this child process when the parent exits. The & makes the xterm command run in the background so that the script can continue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download