run xterm -e without terminating

Use the wait built-in in you shell script. It'll wait until all the background jobs are finished.

Working Example:

#!/bin/bash
# Script to show usage of wait
sleep 20 &
sleep 20 &
sleep 20 &
sleep 20 &
sleep 20 &
wait

The output

sgulati@maverick:~$ bash test.sh
[1]   Done                    sleep 20
[2]   Done                    sleep 20
[3]   Done                    sleep 20
[4]-  Done                    sleep 20
[5]+  Done                    sleep 20
sgulati@maverick:~$ 

I tried -hold, and it leaves xterm in an unresponsive state that requires closing through non-standard means (the window manager, a kill command). If you would rather have an open shell from which you can exit, try adding that shell to the end of your command:

xterm -e "cd /etc; bash"

I came across the answer on Super User.


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.