What is the difference between the -e and -x options for gnome-terminal?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
8
down vote

favorite
2












Man pages state:



-e, --command=STRING
Execute the argument to this option inside the terminal.
-x, --execute
Execute the remainder of the command line inside the terminal.


What is the "command line" in the second example referring to? And what is its "remainder"?
Could you please give an example where these two options differ? Or are they basically the same?







share|improve this question







New contributor




stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 1




    Not exact but found this superuser.com/questions/198015/…
    – Ten-Coin
    Sep 6 at 8:57










  • Great first question.
    – Jared Smith
    Sep 6 at 11:22














up vote
8
down vote

favorite
2












Man pages state:



-e, --command=STRING
Execute the argument to this option inside the terminal.
-x, --execute
Execute the remainder of the command line inside the terminal.


What is the "command line" in the second example referring to? And what is its "remainder"?
Could you please give an example where these two options differ? Or are they basically the same?







share|improve this question







New contributor




stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 1




    Not exact but found this superuser.com/questions/198015/…
    – Ten-Coin
    Sep 6 at 8:57










  • Great first question.
    – Jared Smith
    Sep 6 at 11:22












up vote
8
down vote

favorite
2









up vote
8
down vote

favorite
2






2





Man pages state:



-e, --command=STRING
Execute the argument to this option inside the terminal.
-x, --execute
Execute the remainder of the command line inside the terminal.


What is the "command line" in the second example referring to? And what is its "remainder"?
Could you please give an example where these two options differ? Or are they basically the same?







share|improve this question







New contributor




stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










Man pages state:



-e, --command=STRING
Execute the argument to this option inside the terminal.
-x, --execute
Execute the remainder of the command line inside the terminal.


What is the "command line" in the second example referring to? And what is its "remainder"?
Could you please give an example where these two options differ? Or are they basically the same?









share|improve this question







New contributor




stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Sep 6 at 8:44









stackzebra

1433




1433




New contributor




stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






stackzebra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    Not exact but found this superuser.com/questions/198015/…
    – Ten-Coin
    Sep 6 at 8:57










  • Great first question.
    – Jared Smith
    Sep 6 at 11:22












  • 1




    Not exact but found this superuser.com/questions/198015/…
    – Ten-Coin
    Sep 6 at 8:57










  • Great first question.
    – Jared Smith
    Sep 6 at 11:22







1




1




Not exact but found this superuser.com/questions/198015/…
– Ten-Coin
Sep 6 at 8:57




Not exact but found this superuser.com/questions/198015/…
– Ten-Coin
Sep 6 at 8:57












Great first question.
– Jared Smith
Sep 6 at 11:22




Great first question.
– Jared Smith
Sep 6 at 11:22










1 Answer
1






active

oldest

votes

















up vote
13
down vote



accepted










Consider:



gnome-terminal -x sleep 10m --version
gnome-terminal -e 'sleep 10m' --version


In the first example, everything after -x is used for the command to be executed. So GNOME Terminal will run sleep 10m --version as the command. --version in this case becomes part of the command to be run by GNOME Terminal.



In the second, only the single string argument to -e is used as the command, nothing else. So --version here is actually an option to GNOME Terminal.



The first can be more useful if you want to run a chain of commands:



gnome-terminal -x bash -c 'command 1; command 2; ...'


This is difficult to do with -e, because the entire command needs to be a single string, so you'll have to quote the whole thing. This in turn means that you need to be more careful of quotes and variable expansion and such:



gnome-terminal -e "bash -c 'command 1 $foo; command 2; ...'"


Here, $foo will be expanded by the current shell.



gnome-terminal -e 'bash -c "command 1 | awk '''print $NF'''"' 


Using ' inside the command string involves annoying quote handling.






share|improve this answer
















  • 3




    I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
    – stackzebra
    Sep 6 at 9:32










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






stackzebra is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1072688%2fwhat-is-the-difference-between-the-e-and-x-options-for-gnome-terminal%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
13
down vote



accepted










Consider:



gnome-terminal -x sleep 10m --version
gnome-terminal -e 'sleep 10m' --version


In the first example, everything after -x is used for the command to be executed. So GNOME Terminal will run sleep 10m --version as the command. --version in this case becomes part of the command to be run by GNOME Terminal.



In the second, only the single string argument to -e is used as the command, nothing else. So --version here is actually an option to GNOME Terminal.



The first can be more useful if you want to run a chain of commands:



gnome-terminal -x bash -c 'command 1; command 2; ...'


This is difficult to do with -e, because the entire command needs to be a single string, so you'll have to quote the whole thing. This in turn means that you need to be more careful of quotes and variable expansion and such:



gnome-terminal -e "bash -c 'command 1 $foo; command 2; ...'"


Here, $foo will be expanded by the current shell.



gnome-terminal -e 'bash -c "command 1 | awk '''print $NF'''"' 


Using ' inside the command string involves annoying quote handling.






share|improve this answer
















  • 3




    I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
    – stackzebra
    Sep 6 at 9:32














up vote
13
down vote



accepted










Consider:



gnome-terminal -x sleep 10m --version
gnome-terminal -e 'sleep 10m' --version


In the first example, everything after -x is used for the command to be executed. So GNOME Terminal will run sleep 10m --version as the command. --version in this case becomes part of the command to be run by GNOME Terminal.



In the second, only the single string argument to -e is used as the command, nothing else. So --version here is actually an option to GNOME Terminal.



The first can be more useful if you want to run a chain of commands:



gnome-terminal -x bash -c 'command 1; command 2; ...'


This is difficult to do with -e, because the entire command needs to be a single string, so you'll have to quote the whole thing. This in turn means that you need to be more careful of quotes and variable expansion and such:



gnome-terminal -e "bash -c 'command 1 $foo; command 2; ...'"


Here, $foo will be expanded by the current shell.



gnome-terminal -e 'bash -c "command 1 | awk '''print $NF'''"' 


Using ' inside the command string involves annoying quote handling.






share|improve this answer
















  • 3




    I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
    – stackzebra
    Sep 6 at 9:32












up vote
13
down vote



accepted







up vote
13
down vote



accepted






Consider:



gnome-terminal -x sleep 10m --version
gnome-terminal -e 'sleep 10m' --version


In the first example, everything after -x is used for the command to be executed. So GNOME Terminal will run sleep 10m --version as the command. --version in this case becomes part of the command to be run by GNOME Terminal.



In the second, only the single string argument to -e is used as the command, nothing else. So --version here is actually an option to GNOME Terminal.



The first can be more useful if you want to run a chain of commands:



gnome-terminal -x bash -c 'command 1; command 2; ...'


This is difficult to do with -e, because the entire command needs to be a single string, so you'll have to quote the whole thing. This in turn means that you need to be more careful of quotes and variable expansion and such:



gnome-terminal -e "bash -c 'command 1 $foo; command 2; ...'"


Here, $foo will be expanded by the current shell.



gnome-terminal -e 'bash -c "command 1 | awk '''print $NF'''"' 


Using ' inside the command string involves annoying quote handling.






share|improve this answer












Consider:



gnome-terminal -x sleep 10m --version
gnome-terminal -e 'sleep 10m' --version


In the first example, everything after -x is used for the command to be executed. So GNOME Terminal will run sleep 10m --version as the command. --version in this case becomes part of the command to be run by GNOME Terminal.



In the second, only the single string argument to -e is used as the command, nothing else. So --version here is actually an option to GNOME Terminal.



The first can be more useful if you want to run a chain of commands:



gnome-terminal -x bash -c 'command 1; command 2; ...'


This is difficult to do with -e, because the entire command needs to be a single string, so you'll have to quote the whole thing. This in turn means that you need to be more careful of quotes and variable expansion and such:



gnome-terminal -e "bash -c 'command 1 $foo; command 2; ...'"


Here, $foo will be expanded by the current shell.



gnome-terminal -e 'bash -c "command 1 | awk '''print $NF'''"' 


Using ' inside the command string involves annoying quote handling.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 6 at 9:16









Olorin

1,648619




1,648619







  • 3




    I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
    – stackzebra
    Sep 6 at 9:32












  • 3




    I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
    – stackzebra
    Sep 6 at 9:32







3




3




I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
– stackzebra
Sep 6 at 9:32




I see now. It seems the -x option was probably invented as a convenient way to avoid the problems with quotes.
– stackzebra
Sep 6 at 9:32










stackzebra is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















stackzebra is a new contributor. Be nice, and check out our Code of Conduct.












stackzebra is a new contributor. Be nice, and check out our Code of Conduct.











stackzebra is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1072688%2fwhat-is-the-difference-between-the-e-and-x-options-for-gnome-terminal%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery