2

Put &| on the end of a command seems to detach the process from the shell. But where does it come from? and what's the right way to use it?

Avihoo Mamka
  • 4,656
  • 3
  • 31
  • 44
Feng
  • 2,872
  • 3
  • 23
  • 20

3 Answers3

1

& will cause the process to be detached from the parent process (which in this case is the shell), but won't be disowned from it, which means when you'll close the shell, the process you started will be closed as well.

For disown it completely from the shell you need to do: my_process & and then disown %1

UPDATE

According to the information that the command &| ran on zsh the &| means:

&| - backgrounds the final command of the pipeline.

Avihoo Mamka
  • 4,656
  • 3
  • 31
  • 44
  • what about the pipe ? I cannot find in the manual the &| token but I guess it has a special meaning there no ? – Zermingore Feb 02 '16 at 12:51
  • Actually I didn't find any documentation for the pipe as well, and also tried it in my shell and got: `bash: syntax error near unexpected token |'` – Avihoo Mamka Feb 02 '16 at 12:52
  • I use zsh, &| is different from &. I've tried `jobs` and got nothing. – Feng Feb 02 '16 at 12:57
0

disown [ job ... ]

job ... &|

job ... &!

Remove the specified jobs from the job table; the shell will no longer report their status, and will not complain if you try to exit an interactive shell with them running or stopped. If no job is specified, disown the current job.

Community
  • 1
  • 1
Feng
  • 2,872
  • 3
  • 23
  • 20
-1

& will run the process in background. It will not occupy the terminal no more and wait it until finish.

Ayoub Abid
  • 432
  • 5
  • 15