3

I'm making a Linux installer for Zero-K, an open source RTS game (zero-k.info). It will use zenity for dialogs but for that zenity must be installed. As plenty of people will not already have zenity it must be installed by the script.

I would not like to install something on a user's system without a terminal opening and giving some feedback. If there was no feedback it may look like nothing was happening when it is actually busy installing things. The problem is that the script would have to open xfce4-terminal or gnome-terminal or another DE specific terminal, meaning that there will have to be a different script per DE.

Is there a command to open whatever terminal is used by the OS/DE that the script is used on?

0

2 Answers 2

3

As far as I know, xterm is the standard terminal emulator for the X Window System. So, it should be installed in any Linux like system. To open it with a command executing in it, you can use:

xterm -e "command [args]"

See also man xterm and xterm -help.

If you want to check the existence of some other terminal emulators outside of xterm you can use for example:

if hash gnome-terminal 2>/dev/null; then #if gnome-terminal exists
    gnome-terminal -e "command [args]"
elif hash konsole 2>/dev/null; then #if konsole exists
    konsole -e "command [args]"
#check the existence of some other terminal emulators here
else #you don't need to check the existence of xterm; this should be installed in any Linux like system
    xterm -e "command [args]"
3
  • I agree, xterm should be widely installed on most systems.
    – slm
    Nov 3, 2013 at 20:26
  • Just to be on the safe side, it'd be good to check for the existence of xterm, and if it's not there look for some other terminal emulators, like konsole (KDE), gnome-terminal (GNOME), and so on. Nov 3, 2013 at 22:49
  • @MatthewCline You should not have doubts about the existence of xterm. You can check the existence of other terminal emulators before to use xterm if you wish. See my new edits in this sense. Nov 4, 2013 at 8:03
0

Debian and derivatives (Ubuntu, Mint, etc) use /usr/bin/x-terminal-emulator, which is a symlink managed by debian's alternatives system so that it always points to the system's preferred terminal emulator.

That doesn't help you with RHEL, Fedora, Slackware or many other distributions, but you can check for the existence /usr/bin/x-terminal-emulator first when implementing Radu's answer.

Not the answer you're looking for? Browse other questions tagged .