How to prevent a bash script to close The 2019 Stack Overflow Developer Survey Results Are...

Homework question about an engine pulling a train

What force causes entropy to increase?

Can each chord in a progression create its own key?

One-dimensional Japanese puzzle

should truth entail possible truth

Why are PDP-7-style microprogrammed instructions out of vogue?

Example of compact Riemannian manifold with only one geodesic.

Is an up-to-date browser secure on an out-of-date OS?

Could an empire control the whole planet with today's comunication methods?

Why can't devices on different VLANs, but on the same subnet, communicate?

Using dividends to reduce short term capital gains?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Can the DM override racial traits?

What can I do if neighbor is blocking my solar panels intentionally?

Why can't wing-mounted spoilers be used to steepen approaches?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Word for: a synonym with a positive connotation?

Can a flute soloist sit?

Circular reasoning in L'Hopital's rule

Was credit for the black hole image misappropriated?

Make it rain characters

Why not take a picture of a closer black hole?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?



How to prevent a bash script to close



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
2019 Community Moderator Election ResultsHow to do nothing forever in an elegant way?Is there a Linux command that does nothing, but never exits?Controlling bash script concurrency, flock inheritanceShell script wrapper to prevent running command with no arguments?How to assign the cat output of a bash script to a variable in another scriptWhy does “bash -x” break this script?How to prevent script from deleting itselflock bash script to prevent parallel running from within the script itself?Subshell for Bash ScriptBash running multiple program and handling closeHow to disable terminal scrolling in a Bash script?How to convert a very small bash script into a single line command





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







-1















How can I prevent a bash script from closing, so block itself from closing.



Is there a command that executes a command if there is no action?










share|improve this question







New contributor




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





















  • Welcome to Unix & Linux :-) while : ; do done; anywhere inside your bash script or at the end will prevent a bash script from closing but that'll be of very little use. Can you edit your question and provide the current bash script that you're trying to prevent to close?

    – Fabby
    6 hours ago








  • 2





    Despite deleting and recreating this question, we still aren't clear on what you are asking. A shell script typically runs through its commands and then exits (closes, ends, etc.) Some programs, which may be bash scripts, can remain open and behave interactively with a users input or other externals. But if a script comes to the end, it finishes, closes, exits. Your question comes across like "how can I prevent the Night from ending?" Perhaps reconsider your problem and edit the question to ask a different aspect of the problem?

    – 0xSheepdog
    6 hours ago




















-1















How can I prevent a bash script from closing, so block itself from closing.



Is there a command that executes a command if there is no action?










share|improve this question







New contributor




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





















  • Welcome to Unix & Linux :-) while : ; do done; anywhere inside your bash script or at the end will prevent a bash script from closing but that'll be of very little use. Can you edit your question and provide the current bash script that you're trying to prevent to close?

    – Fabby
    6 hours ago








  • 2





    Despite deleting and recreating this question, we still aren't clear on what you are asking. A shell script typically runs through its commands and then exits (closes, ends, etc.) Some programs, which may be bash scripts, can remain open and behave interactively with a users input or other externals. But if a script comes to the end, it finishes, closes, exits. Your question comes across like "how can I prevent the Night from ending?" Perhaps reconsider your problem and edit the question to ask a different aspect of the problem?

    – 0xSheepdog
    6 hours ago
















-1












-1








-1


1






How can I prevent a bash script from closing, so block itself from closing.



Is there a command that executes a command if there is no action?










share|improve this question







New contributor




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












How can I prevent a bash script from closing, so block itself from closing.



Is there a command that executes a command if there is no action?







shell-script






share|improve this question







New contributor




Justpixel minecraft 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







New contributor




Justpixel minecraft 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




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









asked 6 hours ago









Justpixel minecraftJustpixel minecraft

12




12




New contributor




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





New contributor





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






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













  • Welcome to Unix & Linux :-) while : ; do done; anywhere inside your bash script or at the end will prevent a bash script from closing but that'll be of very little use. Can you edit your question and provide the current bash script that you're trying to prevent to close?

    – Fabby
    6 hours ago








  • 2





    Despite deleting and recreating this question, we still aren't clear on what you are asking. A shell script typically runs through its commands and then exits (closes, ends, etc.) Some programs, which may be bash scripts, can remain open and behave interactively with a users input or other externals. But if a script comes to the end, it finishes, closes, exits. Your question comes across like "how can I prevent the Night from ending?" Perhaps reconsider your problem and edit the question to ask a different aspect of the problem?

    – 0xSheepdog
    6 hours ago





















  • Welcome to Unix & Linux :-) while : ; do done; anywhere inside your bash script or at the end will prevent a bash script from closing but that'll be of very little use. Can you edit your question and provide the current bash script that you're trying to prevent to close?

    – Fabby
    6 hours ago








  • 2





    Despite deleting and recreating this question, we still aren't clear on what you are asking. A shell script typically runs through its commands and then exits (closes, ends, etc.) Some programs, which may be bash scripts, can remain open and behave interactively with a users input or other externals. But if a script comes to the end, it finishes, closes, exits. Your question comes across like "how can I prevent the Night from ending?" Perhaps reconsider your problem and edit the question to ask a different aspect of the problem?

    – 0xSheepdog
    6 hours ago



















Welcome to Unix & Linux :-) while : ; do done; anywhere inside your bash script or at the end will prevent a bash script from closing but that'll be of very little use. Can you edit your question and provide the current bash script that you're trying to prevent to close?

– Fabby
6 hours ago







Welcome to Unix & Linux :-) while : ; do done; anywhere inside your bash script or at the end will prevent a bash script from closing but that'll be of very little use. Can you edit your question and provide the current bash script that you're trying to prevent to close?

– Fabby
6 hours ago






2




2





Despite deleting and recreating this question, we still aren't clear on what you are asking. A shell script typically runs through its commands and then exits (closes, ends, etc.) Some programs, which may be bash scripts, can remain open and behave interactively with a users input or other externals. But if a script comes to the end, it finishes, closes, exits. Your question comes across like "how can I prevent the Night from ending?" Perhaps reconsider your problem and edit the question to ask a different aspect of the problem?

– 0xSheepdog
6 hours ago







Despite deleting and recreating this question, we still aren't clear on what you are asking. A shell script typically runs through its commands and then exits (closes, ends, etc.) Some programs, which may be bash scripts, can remain open and behave interactively with a users input or other externals. But if a script comes to the end, it finishes, closes, exits. Your question comes across like "how can I prevent the Night from ending?" Perhaps reconsider your problem and edit the question to ask a different aspect of the problem?

– 0xSheepdog
6 hours ago












1 Answer
1






active

oldest

votes


















4














From your other (now deleted) question, it seems you want to run



xterm -e your-script


And the terminal emulator window not to go away after the script finishes.



For that, you could add a command that sleeps forever at the end of your script, or in an EXIT trap. See How to do nothing forever in an elegant way? or Is there a Linux command that does nothing, but never exits? for some options.



trap 'sleep infinity' EXIT


Would cause the shell to run sleep infinity upon exit, and so never exit. With those sleep implementations that don't support infinity, replace with a large number, like sleep 2147483647 (the largest 32 bit signed integer which should be safe on most systems and is about 68 years).



With xterm, you can also use its -hold option which is designed for that.






share|improve this answer





















  • 1





    :D +1 for 68 years!

    – Fabby
    5 hours ago












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});


}
});






Justpixel minecraft 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%2funix.stackexchange.com%2fquestions%2f512172%2fhow-to-prevent-a-bash-script-to-close%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














From your other (now deleted) question, it seems you want to run



xterm -e your-script


And the terminal emulator window not to go away after the script finishes.



For that, you could add a command that sleeps forever at the end of your script, or in an EXIT trap. See How to do nothing forever in an elegant way? or Is there a Linux command that does nothing, but never exits? for some options.



trap 'sleep infinity' EXIT


Would cause the shell to run sleep infinity upon exit, and so never exit. With those sleep implementations that don't support infinity, replace with a large number, like sleep 2147483647 (the largest 32 bit signed integer which should be safe on most systems and is about 68 years).



With xterm, you can also use its -hold option which is designed for that.






share|improve this answer





















  • 1





    :D +1 for 68 years!

    – Fabby
    5 hours ago
















4














From your other (now deleted) question, it seems you want to run



xterm -e your-script


And the terminal emulator window not to go away after the script finishes.



For that, you could add a command that sleeps forever at the end of your script, or in an EXIT trap. See How to do nothing forever in an elegant way? or Is there a Linux command that does nothing, but never exits? for some options.



trap 'sleep infinity' EXIT


Would cause the shell to run sleep infinity upon exit, and so never exit. With those sleep implementations that don't support infinity, replace with a large number, like sleep 2147483647 (the largest 32 bit signed integer which should be safe on most systems and is about 68 years).



With xterm, you can also use its -hold option which is designed for that.






share|improve this answer





















  • 1





    :D +1 for 68 years!

    – Fabby
    5 hours ago














4












4








4







From your other (now deleted) question, it seems you want to run



xterm -e your-script


And the terminal emulator window not to go away after the script finishes.



For that, you could add a command that sleeps forever at the end of your script, or in an EXIT trap. See How to do nothing forever in an elegant way? or Is there a Linux command that does nothing, but never exits? for some options.



trap 'sleep infinity' EXIT


Would cause the shell to run sleep infinity upon exit, and so never exit. With those sleep implementations that don't support infinity, replace with a large number, like sleep 2147483647 (the largest 32 bit signed integer which should be safe on most systems and is about 68 years).



With xterm, you can also use its -hold option which is designed for that.






share|improve this answer















From your other (now deleted) question, it seems you want to run



xterm -e your-script


And the terminal emulator window not to go away after the script finishes.



For that, you could add a command that sleeps forever at the end of your script, or in an EXIT trap. See How to do nothing forever in an elegant way? or Is there a Linux command that does nothing, but never exits? for some options.



trap 'sleep infinity' EXIT


Would cause the shell to run sleep infinity upon exit, and so never exit. With those sleep implementations that don't support infinity, replace with a large number, like sleep 2147483647 (the largest 32 bit signed integer which should be safe on most systems and is about 68 years).



With xterm, you can also use its -hold option which is designed for that.







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 6 hours ago









Stéphane ChazelasStéphane Chazelas

314k57594952




314k57594952








  • 1





    :D +1 for 68 years!

    – Fabby
    5 hours ago














  • 1





    :D +1 for 68 years!

    – Fabby
    5 hours ago








1




1





:D +1 for 68 years!

– Fabby
5 hours ago





:D +1 for 68 years!

– Fabby
5 hours ago










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










draft saved

draft discarded


















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













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












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
















Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512172%2fhow-to-prevent-a-bash-script-to-close%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m