I have the following script in my arch linux box:#!/bin/bashxterm -e sudo pacman -Syu;bashThis will fire up an xterm, and run the command sudo pacman -Syu on it. Because of the ;bash part, it will not close the xterm window once the command is finished. This is a command for updating my system and I don't want it to close because I'd like to see the output.My question is why this will not work with other terminals, and in particular with lxterminal and roxterm (the only others I tried). The exact same command with lxterminal or roxterm instead of xterm will fire up the terminal, and close it immediately after the command is executed.
Opening a terminal other than xterm, running a command on it, and not closing the terminal after it succesfully finished
bash;scripting;xterm;lxterminal
The essential problem is that the VTE-based terminals don't handle the command-line in the same way as xterm.  That's beside the possible problems with the (unnecessary in this discussion) hold option.The quotes in this commandxterm -e sudo pacman -Syu;bashare the issue.  That quoted string is a single token, passed to xterm as a single parameter.With xterm, the tokens after -e are first tried as parameters for an execv call.  Failing that, it tries something like sh -c parameters.  konsole does one or the other (probably the first, since that was the original behavior of xterm, and most of konsole's design dates from the late 1990s).  When xterm was modified for luit, the failing that alternative helped with passing parameters to luit.The VTE-based terminals for a while tried doing one aspect in one command-line option and the other in another option (as I recall it, -e and -x, but swapping the roles of the two options and the subject of an interesting Debian bug report that I don't see at the moment).  In the current version, trying gnome-terminal -e sudo pacman -Syu;bashfails because it only works with the original xterm-like behavior.  And (keeping in mind that the other terminals use somewhat older versions of VTE), since the gnome-terminal's developers (who overlap with VTE developers...) dropped the -x option a while back, that option isn't available for the command.  This works because it follows the original xterm model:gnome-terminal -e bash -c \sudo pacman -Syu;bash\The -e option is partly addressed in Debian by a shell script, which attempts to provide a minimal set of options (including one for title).  The Debian policy for this was based on xterm in the late 1990s, and has been a topic of discussion more than once.Further reading:Debian #648271:11.8.3 Packages providing a terminal emulator says xterm passes -e option straight to execDebian  #275409:-T does not work with the x-terminal-emulator providerGnome #701691: -e accepts only one term; all other terminal emulators accept more than one term