How to keep Lxterminal open after running .desktop shortcut
I made a .desktop file to compile and execute a c++ file but the terminal (lxterminal - lubuntu) is not holding after running the file.
Although I did mark "Keep terminal window open after command execution." on the .desktop file properties !
I am using Lubuntu 16.04.1 LXDE desktop environment.
command-line 16.04 lubuntu lxterminal
add a comment |
I made a .desktop file to compile and execute a c++ file but the terminal (lxterminal - lubuntu) is not holding after running the file.
Although I did mark "Keep terminal window open after command execution." on the .desktop file properties !
I am using Lubuntu 16.04.1 LXDE desktop environment.
command-line 16.04 lubuntu lxterminal
What do you want to do with the terminal after the command execution? Only look at the result, or do you want to run new commands in it?
– sudodus
Jan 6 '17 at 17:58
I have to look at the result.
– Ebram Shehata
Jan 6 '17 at 18:11
@EbramShehata did you find any solution for this ?
– Vincent Wasteels
Jun 8 '17 at 9:05
@VincentWasteels both answers forgot that-e
doesn't run another shell, so it can't parse command sequence. Just add the shell explicitly and it will work.Exec=lxterminal -e "/bin/bash -c '/path/to/yourCommand; read -n 1 -s'"
– Marek Rost
Jan 2 '18 at 10:22
add a comment |
I made a .desktop file to compile and execute a c++ file but the terminal (lxterminal - lubuntu) is not holding after running the file.
Although I did mark "Keep terminal window open after command execution." on the .desktop file properties !
I am using Lubuntu 16.04.1 LXDE desktop environment.
command-line 16.04 lubuntu lxterminal
I made a .desktop file to compile and execute a c++ file but the terminal (lxterminal - lubuntu) is not holding after running the file.
Although I did mark "Keep terminal window open after command execution." on the .desktop file properties !
I am using Lubuntu 16.04.1 LXDE desktop environment.
command-line 16.04 lubuntu lxterminal
command-line 16.04 lubuntu lxterminal
asked Jan 6 '17 at 17:47
Ebram ShehataEbram Shehata
4910
4910
What do you want to do with the terminal after the command execution? Only look at the result, or do you want to run new commands in it?
– sudodus
Jan 6 '17 at 17:58
I have to look at the result.
– Ebram Shehata
Jan 6 '17 at 18:11
@EbramShehata did you find any solution for this ?
– Vincent Wasteels
Jun 8 '17 at 9:05
@VincentWasteels both answers forgot that-e
doesn't run another shell, so it can't parse command sequence. Just add the shell explicitly and it will work.Exec=lxterminal -e "/bin/bash -c '/path/to/yourCommand; read -n 1 -s'"
– Marek Rost
Jan 2 '18 at 10:22
add a comment |
What do you want to do with the terminal after the command execution? Only look at the result, or do you want to run new commands in it?
– sudodus
Jan 6 '17 at 17:58
I have to look at the result.
– Ebram Shehata
Jan 6 '17 at 18:11
@EbramShehata did you find any solution for this ?
– Vincent Wasteels
Jun 8 '17 at 9:05
@VincentWasteels both answers forgot that-e
doesn't run another shell, so it can't parse command sequence. Just add the shell explicitly and it will work.Exec=lxterminal -e "/bin/bash -c '/path/to/yourCommand; read -n 1 -s'"
– Marek Rost
Jan 2 '18 at 10:22
What do you want to do with the terminal after the command execution? Only look at the result, or do you want to run new commands in it?
– sudodus
Jan 6 '17 at 17:58
What do you want to do with the terminal after the command execution? Only look at the result, or do you want to run new commands in it?
– sudodus
Jan 6 '17 at 17:58
I have to look at the result.
– Ebram Shehata
Jan 6 '17 at 18:11
I have to look at the result.
– Ebram Shehata
Jan 6 '17 at 18:11
@EbramShehata did you find any solution for this ?
– Vincent Wasteels
Jun 8 '17 at 9:05
@EbramShehata did you find any solution for this ?
– Vincent Wasteels
Jun 8 '17 at 9:05
@VincentWasteels both answers forgot that
-e
doesn't run another shell, so it can't parse command sequence. Just add the shell explicitly and it will work. Exec=lxterminal -e "/bin/bash -c '/path/to/yourCommand; read -n 1 -s'"
– Marek Rost
Jan 2 '18 at 10:22
@VincentWasteels both answers forgot that
-e
doesn't run another shell, so it can't parse command sequence. Just add the shell explicitly and it will work. Exec=lxterminal -e "/bin/bash -c '/path/to/yourCommand; read -n 1 -s'"
– Marek Rost
Jan 2 '18 at 10:22
add a comment |
3 Answers
3
active
oldest
votes
I don't know if this is optimal for you use case, but you can put yourCommand; read -n 1 -s
in the Exec line of your .desktop file, causing the terminal to wait for one character input (silently, not echoing it back to stdout).
You should end with something like this:
Exec=lxterminal -e "/path/to/yourCommand; read -n 1 -s"
Also can use &&
or ||
according to you app exit value/code, waiting only if execution was successful, for example:
Exec=lxterminal -e "/path/to/yourCommand && read -n 1 -s"
Hope it helps.
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
add a comment |
You can run your command(s) via a shellscript. (Maybe you do that already.) And at the end of the shellscript you add a line, for example like this:
read -p "Press Enter to close this window"
Then you can scroll the window and check the output from your command(s), and then press Enter to get rid of the terminal window.
I don't know why the first method did not work. Maybe your script or some program called by it is sending a signal that finishes the script at once (without reaching the final statement). You could try to fix that, but maybe it is easier to run in an xterm window (tweaked to look better and with the -hold
option.
Please compare how these two command lines work:
xterm -e cat ~/.bashrc
xterm -hold -e cat ~/.bashrc
You can tweak the xterm window to look better, for example like this
xterm -title "Click x in the top right corner to close me" -fa default -fs 10 -bg '#2b2c2b' -fg '#f0f0f0' -sb -rightbar -hold -e cat ~/.bashrc
Put the name of your script after -e in the xterm command line, or start the xterm in interactive mode (with the hold feature), and start your script in xterm.
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
add a comment |
You can use this
lxterminal -e bash -c 'top; bash'
Just replace "top" with your command.
New contributor
add a comment |
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',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f868798%2fhow-to-keep-lxterminal-open-after-running-desktop-shortcut%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't know if this is optimal for you use case, but you can put yourCommand; read -n 1 -s
in the Exec line of your .desktop file, causing the terminal to wait for one character input (silently, not echoing it back to stdout).
You should end with something like this:
Exec=lxterminal -e "/path/to/yourCommand; read -n 1 -s"
Also can use &&
or ||
according to you app exit value/code, waiting only if execution was successful, for example:
Exec=lxterminal -e "/path/to/yourCommand && read -n 1 -s"
Hope it helps.
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
add a comment |
I don't know if this is optimal for you use case, but you can put yourCommand; read -n 1 -s
in the Exec line of your .desktop file, causing the terminal to wait for one character input (silently, not echoing it back to stdout).
You should end with something like this:
Exec=lxterminal -e "/path/to/yourCommand; read -n 1 -s"
Also can use &&
or ||
according to you app exit value/code, waiting only if execution was successful, for example:
Exec=lxterminal -e "/path/to/yourCommand && read -n 1 -s"
Hope it helps.
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
add a comment |
I don't know if this is optimal for you use case, but you can put yourCommand; read -n 1 -s
in the Exec line of your .desktop file, causing the terminal to wait for one character input (silently, not echoing it back to stdout).
You should end with something like this:
Exec=lxterminal -e "/path/to/yourCommand; read -n 1 -s"
Also can use &&
or ||
according to you app exit value/code, waiting only if execution was successful, for example:
Exec=lxterminal -e "/path/to/yourCommand && read -n 1 -s"
Hope it helps.
I don't know if this is optimal for you use case, but you can put yourCommand; read -n 1 -s
in the Exec line of your .desktop file, causing the terminal to wait for one character input (silently, not echoing it back to stdout).
You should end with something like this:
Exec=lxterminal -e "/path/to/yourCommand; read -n 1 -s"
Also can use &&
or ||
according to you app exit value/code, waiting only if execution was successful, for example:
Exec=lxterminal -e "/path/to/yourCommand && read -n 1 -s"
Hope it helps.
answered Jan 6 '17 at 18:28
dgonzalezdgonzalez
3,89031024
3,89031024
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
add a comment |
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
Non of these two methods worked :( , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:23
add a comment |
You can run your command(s) via a shellscript. (Maybe you do that already.) And at the end of the shellscript you add a line, for example like this:
read -p "Press Enter to close this window"
Then you can scroll the window and check the output from your command(s), and then press Enter to get rid of the terminal window.
I don't know why the first method did not work. Maybe your script or some program called by it is sending a signal that finishes the script at once (without reaching the final statement). You could try to fix that, but maybe it is easier to run in an xterm window (tweaked to look better and with the -hold
option.
Please compare how these two command lines work:
xterm -e cat ~/.bashrc
xterm -hold -e cat ~/.bashrc
You can tweak the xterm window to look better, for example like this
xterm -title "Click x in the top right corner to close me" -fa default -fs 10 -bg '#2b2c2b' -fg '#f0f0f0' -sb -rightbar -hold -e cat ~/.bashrc
Put the name of your script after -e in the xterm command line, or start the xterm in interactive mode (with the hold feature), and start your script in xterm.
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
add a comment |
You can run your command(s) via a shellscript. (Maybe you do that already.) And at the end of the shellscript you add a line, for example like this:
read -p "Press Enter to close this window"
Then you can scroll the window and check the output from your command(s), and then press Enter to get rid of the terminal window.
I don't know why the first method did not work. Maybe your script or some program called by it is sending a signal that finishes the script at once (without reaching the final statement). You could try to fix that, but maybe it is easier to run in an xterm window (tweaked to look better and with the -hold
option.
Please compare how these two command lines work:
xterm -e cat ~/.bashrc
xterm -hold -e cat ~/.bashrc
You can tweak the xterm window to look better, for example like this
xterm -title "Click x in the top right corner to close me" -fa default -fs 10 -bg '#2b2c2b' -fg '#f0f0f0' -sb -rightbar -hold -e cat ~/.bashrc
Put the name of your script after -e in the xterm command line, or start the xterm in interactive mode (with the hold feature), and start your script in xterm.
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
add a comment |
You can run your command(s) via a shellscript. (Maybe you do that already.) And at the end of the shellscript you add a line, for example like this:
read -p "Press Enter to close this window"
Then you can scroll the window and check the output from your command(s), and then press Enter to get rid of the terminal window.
I don't know why the first method did not work. Maybe your script or some program called by it is sending a signal that finishes the script at once (without reaching the final statement). You could try to fix that, but maybe it is easier to run in an xterm window (tweaked to look better and with the -hold
option.
Please compare how these two command lines work:
xterm -e cat ~/.bashrc
xterm -hold -e cat ~/.bashrc
You can tweak the xterm window to look better, for example like this
xterm -title "Click x in the top right corner to close me" -fa default -fs 10 -bg '#2b2c2b' -fg '#f0f0f0' -sb -rightbar -hold -e cat ~/.bashrc
Put the name of your script after -e in the xterm command line, or start the xterm in interactive mode (with the hold feature), and start your script in xterm.
You can run your command(s) via a shellscript. (Maybe you do that already.) And at the end of the shellscript you add a line, for example like this:
read -p "Press Enter to close this window"
Then you can scroll the window and check the output from your command(s), and then press Enter to get rid of the terminal window.
I don't know why the first method did not work. Maybe your script or some program called by it is sending a signal that finishes the script at once (without reaching the final statement). You could try to fix that, but maybe it is easier to run in an xterm window (tweaked to look better and with the -hold
option.
Please compare how these two command lines work:
xterm -e cat ~/.bashrc
xterm -hold -e cat ~/.bashrc
You can tweak the xterm window to look better, for example like this
xterm -title "Click x in the top right corner to close me" -fa default -fs 10 -bg '#2b2c2b' -fg '#f0f0f0' -sb -rightbar -hold -e cat ~/.bashrc
Put the name of your script after -e in the xterm command line, or start the xterm in interactive mode (with the hold feature), and start your script in xterm.
edited Jan 10 '17 at 11:37
answered Jan 6 '17 at 18:19
sudodussudodus
23k32874
23k32874
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
add a comment |
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
It didn't work , the terminal closes .
– Ebram Shehata
Jan 10 '17 at 10:22
add a comment |
You can use this
lxterminal -e bash -c 'top; bash'
Just replace "top" with your command.
New contributor
add a comment |
You can use this
lxterminal -e bash -c 'top; bash'
Just replace "top" with your command.
New contributor
add a comment |
You can use this
lxterminal -e bash -c 'top; bash'
Just replace "top" with your command.
New contributor
You can use this
lxterminal -e bash -c 'top; bash'
Just replace "top" with your command.
New contributor
New contributor
answered 2 days ago
KrisKris
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f868798%2fhow-to-keep-lxterminal-open-after-running-desktop-shortcut%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What do you want to do with the terminal after the command execution? Only look at the result, or do you want to run new commands in it?
– sudodus
Jan 6 '17 at 17:58
I have to look at the result.
– Ebram Shehata
Jan 6 '17 at 18:11
@EbramShehata did you find any solution for this ?
– Vincent Wasteels
Jun 8 '17 at 9:05
@VincentWasteels both answers forgot that
-e
doesn't run another shell, so it can't parse command sequence. Just add the shell explicitly and it will work.Exec=lxterminal -e "/bin/bash -c '/path/to/yourCommand; read -n 1 -s'"
– Marek Rost
Jan 2 '18 at 10:22