How to hold terminal open (excepting gnome-terminal)?
You can achieve this in any terminal emulator by the simple expedient of arranging for the program not to exit without user confirmation. Tell the terminal to run terminal_shell_wrapper
which is a script containing something like
#!/bin/sh
if [ $# -eq 0 ]; then "${SHELL:-sh}"; else "$@"; fi
echo "The command exited with status $?. Press Enter to close the terminal."
read line
If you want any key press to close the terminal change read line
to
stty -icanon; dd ibs=1 count=1 >/dev/null 2>&1
There are other terminals that have options to keep the terminal open, some by specifying a profile with that setting enabled (just like in Gnome Terminal) and some with a specific argument.
Xterm
xterm -hold
from $(man xterm):
-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.
Running xterm --help
, one of the lines is
-/+hold turn on/off logic that retains window after exit
To see if other terminals have a similar option, look at their help or man page.
Konsole
(default in KDE):
konsole --help
shows this line:
--hold, --noclose Do not close the initial session automatically when it ends.
So, the command to use for Konsole will include:
konsole --hold
or konsole --nonclose
. It does not need quotation marks. It could be something like:
Exec=konsole --hold -e mediainfo -i %f
Xfce4-terminal
Tab Options:
-x, --execute; -e, --command=command; -T, --title=title;
--working-directory=directory; -H, --hold
So:
xfce4-terminal -H -e '<command>'
Terminator
It has an option similar to that in Gnome Terminal, you have to create a profile - e.g. called "hold" - with that option enabled.
To run command and stay open:
terminator -e '<command>' -p hold
.