I've seen this issue discussed before. If I remember correctly, the -e
option will execute the command, and the terminal will stay open for only as long as that command is active. If it's an interactive program like a text editor, it will stay open until you close that program. But something like echo simply prints and exits, and so the the terminal does also.
There is a -hold
option, which will keep the window from being destroyed immediately, but the window is basically dead after that, with no more shell interaction possible. You have to kill the process in the launching shell or otherwise forcibly close the window. AFAIK, there's no way to use -e
and still have an active shell after that command finishes running.
Edit: It looks like it's possible to do something like this:
xterm -e "( echo "foo" && bash )"
This will first run echo, and then a new bash shell inside the xterm. Of course this is because the commands are running inside a nested subshell of their own, so there's an extra layer involved, but that may be something you can live with.