I am writing a bash script and would like the very last command to start as a separate process. The last command also sends all output to a file. I also, however, want the output to still appear on the console. What I have so far is,
$ command > "file" &
This sends the output to "file" and also starts the command as its own process. However, I also want to view the output in the console at the same time (but if I hit ctrl+c or w/e, the command doesnt stop). This is a lot like this question, but with the caviat that it needs to be its own thread.
I have tried:
$ command | tee "file" &
but the problem is that tee is than part of the process, and output doesn't actually appear..
So, just to clarify, I want to have
command on its own process, sending output to a file, but still have the output appear in the console (until I hit q, enter, ctrl+c, or something). Since this is in a bash script, two separate lines would be acceptable.