Score:0

Exit from bash script while it's running

mn flag

How can I exit a bash script without interrupting its running state? Say that I've launched the bash script and then realized that it's going to run longer than I initially thought, so I want to leave it in the background and do other stuff.

There are options like:

  • CTRL-C -> Doesn't work, because I want the script to run in the background.
  • exit 0/1 -> Doesn't work, because I have to edit the script - can't do it while it's running

Any tips would be welcome!

Thanks

terdon avatar
cn flag
Just press Ctrl+Z. See [How to send a process to background and foreground?](https://askubuntu.com/q/819924) or [Running programs in the background from terminal](https://askubuntu.com/a/106910) or [I can't use the terminal while gedit command is running](https://askubuntu.com/q/319843).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.