How do you make the escaping work so that the &
is actually running the first command in the background?
# foo param1 param2 >> run.out &; tail -f run.out
How do you make the escaping work so that the &
is actually running the first command in the background?
# foo param1 param2 >> run.out &; tail -f run.out
Just drop the semicolon:
# foo param1 param2 >> run.out & tail -f run.out
You need to put the backgrounded command in ()'s.
(ls -R / >>/tmp/list & ); tail -f /tmp/list
Sadly, this really backgrounds it. You won't be able to us %1 to get to its PID.
I just ran into this question as well, and solved it this way:
`foo param1 param2 >> run.out &` ; tail -f run.out
I don't know if the semantics are different.
For this specific case, the following is also useful:
foo param1 param2 | tee -a run.out