What is the difference between the -e and -x options for gnome-terminal?
Clash Royale CLAN TAG#URR8PPP
up vote
8
down vote
favorite
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?
command-line gnome-terminal
New contributor
add a comment |Â
up vote
8
down vote
favorite
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?
command-line gnome-terminal
New contributor
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
add a comment |Â
up vote
8
down vote
favorite
up vote
8
down vote
favorite
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?
command-line gnome-terminal
New contributor
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?
command-line gnome-terminal
New contributor
New contributor
asked Sep 6 at 8:44
stackzebra
1433
1433
New contributor
New contributor
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
add a comment |Â
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
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.
stackzebra is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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