0

If I execute a program using the -e option for xterm and close this program, then xterm closed as well, e.g.

xterm -hold -e "nano"

The window (i3wm) is still there but it's empty and I'm not able to do any inputs. How to run xterm like in the example above with a additional requirement, a callback for xterm if I closed nano?

What I can do is:

xterm -hold -e "nano;bash"

But I don't understand, why I have to start a shell like bash again. I thought xterm already should run a shell.

2
  • Why are you using -hold in the first place? -hold means "don't destroy the window, wait for the window manager to do it", and that's exactly what happens. If you want to start a new xterm with a login shell, why don't you use just xterm? Or do you want to start a login shell, and execute a command within this shell, and then continue to use the shell? Commented May 10, 2017 at 6:33
  • @dirkt, your second guess, is what I'm looking for. Commented May 10, 2017 at 8:38

1 Answer 1

2

xterm -hold -e cmd will run cmd in a new xterm window and then keep the window displayed after the command has exited (it would normally close the window).

If you want an interactive shell in the window after running an initial command, then

xterm -e 'cmd; bash'

will do this. There's no need for -hold as the window doesn't close until the shell session exits.

xterm can be used to run any program. By default it runs a shell, but with -e you change this default behaviour. xterm -e mutt, for example, would run the email reader mutt instead of a shell.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.