How do I get shell prompt back after execute script How do I get shell prompt back after execute script unix unix

How do I get shell prompt back after execute script


Without testing, I'm wondering if you want this:

#!/bin/bashnohup sudo -u user program -p4xxx &disown

That will background the sudo process, and disassociate it from the calling shell (the script).


(From https://askubuntu.com/questions/121559)

After you start a process (job), you can still do other things. You might want to write these down as a cheat sheet.

  1. Ctrl+c Kill the running process (foreground job)
  2. Ctrl+z Pause running process (foreground job) and return to the prompt
  3. Type jobs Shows you all background jobs on the terminal
  4. Type bg Makes the last paused job continue in the background
  5. Type fg Returns the last pause job to the foreground

You can also type bg or fg with a number after, like fg 3. This will bring job #3 to the foreground.


Two alternative:

  1. Bring background job foreground with fg and send signal withctrl+c
  2. Directly kill background process(correspond to program job)with pkill program