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.
- Ctrl+c Kill the running process (foreground job)
- Ctrl+z Pause running process (foreground job) and return to the prompt
- Type jobs Shows you all background jobs on the terminal
- Type bg Makes the last paused job continue in the background
- 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:
- Bring background job foreground with
fg
and send signal withctrl+c
- Directly kill background process(correspond to
program
job)withpkill program