After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701691 - -e accepts only one term; all other terminal emulators accept more than one term
-e accepts only one term; all other terminal emulators accept more than one term
Product: gnome-terminal
Classification: Core
Component: general
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Reported: 2013-06-06 03:41 UTC by niku
Modified: 2013-06-07 11:21 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description niku 2013-06-06 03:41:41 UTC

From the gnome-terminal man page:

       -e, --command=STRING
                 Execute the argument to this option inside the terminal.

       -x, --execute
                 Execute the remainder of the command line inside the terminal.

This behaviour is inconsistent with all other terminal emulators. This 
inconsistency creates problems. From the linked page:

`xterm -e vim file' -- I get vim with the file open.
`gnome-terminal -e vim file' -- I just get vim. To have vim open the file
        too I have to say:
`gnome-terminal -e "vim file" '.

This necessitates a workaround ['hut' on the]: 

# filename: /usr/bin/gnometerm
from subprocess import Popen
from sys import argv
def shell_quote(string): return "'" + str(string).replace("'", "'\\''") + "'"
Popen(["gnome-terminal", argv[1], (" ".join(shell_quote(arg) for arg in argv[2:]))])


Developers, please consider making the behaviour of -e consistent with 
other terminal emulators! In gnome-terminal since -e is just a subset
of -x can you not just make -e a synonym of -x? There is this though:
g-t allows other options after -e, so it may break existing scripts.
Contrawise, wouldn't scripts use xterm, and not gnome-terminal?

From the man pages:

       -e program [ arguments ... ]
               This option specifies the program (and its command line
               arguments) to be run in the xterm window. This must be
               the last option on the command line.

       -e <command> [ arguments ]
              Execute ’command’ instead of shell. 
              This must be the last option on the command line.

       -e --execute
           Execute remainder of command line inside the terminal. Must be
           final option.
Comment 1 Christian Persch 2013-06-06 11:10:43 UTC
This works as designed. Note that both -x and -e are deprecated; the only supported way to pass the arguments is after -- like this:

$ gnome-terminal -- emacs file
Comment 2 niku 2013-06-06 13:36:35 UTC
Thanks for the reply! This solution is the best, as changing the interface would have been horrible anyway.

This (`--') way to pass the executable is not mentioned in my man page (v., even though it works in my version. Could you or someone please add this in the man page? Also, please mention that -x and -e are deprecated. Thanks.
Comment 3 Christian Persch 2013-06-06 13:59:18 UTC
The man page is a debian addition and doesn't exist upstream (bug 311565).
Comment 4 niku 2013-06-06 14:39:14 UTC
Ok, I will inform the Debian package maintainer. But, in that case, where is the documentation users are supposed to consult? Is there a page describing all this that the package manager can check to update the man page?
Comment 5 Christian Persch 2013-06-06 16:02:54 UTC
There are no docs for the gnome-terminal command line options.
Comment 6 niku 2013-06-07 11:21:13 UTC
Thanks for your replies. I have submitted a bug report with Debian: