0

Is there a Bash equivalent of Z Shell's &! (or &|), i.e., immediately disown a job after it is started? I looked in Bash Reference Manual and searched in Google but can't seem to find anything relevant.

2
  • I'm confused. Your question title reads immediately disown job after it is started, but in the comment to Sirex's answer you write: This question is not about how to disown a job immediately. So, what is your question? Is something like sleep 20 & disown or (sleep 20 &) a solution to your problem? BTW what is your goal, that we don't run into another xy problem?
    – mpy
    Dec 11, 2014 at 21:30
  • @mpy Simple. Bash equivalent of zsh &! or &|. Basically yes no answer. "This question is not about how to disown a job immediately" means I'm not interested in practical solutions because I know plenty. Maybe I should close this by now since I suppose the answer is no.
    – 4ae1e1
    Dec 11, 2014 at 21:33

1 Answer 1

0

nohup <cmd> should do the job for you

7
  • This question is not about how to disown a job immediately (I know how to do that, and I could put the disown on the same line and achieve essentially the same effect), but rather, if this is a feature of Bash (and if so, how). nohup is a third party command, and it's certainly not a "Bash equivalent of Z Shell's &!".
    – 4ae1e1
    Dec 9, 2014 at 19:07
  • oh right. no, it's not a part of bash (that i know of).
    – Sirex
    Dec 9, 2014 at 19:09
  • Also, nohup redirects stdout and stderr to file if they are connected to a tty, so that's definitely not equivalent.
    – 4ae1e1
    Dec 9, 2014 at 19:09
  • "no, it's not a part of bash (that i know of)." That's also what I thought. Just to make sure.
    – 4ae1e1
    Dec 9, 2014 at 19:10
  • yeah, but you can just redirect both stdout and stderr to /dev/null
    – Sirex
    Dec 9, 2014 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .