Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
is '&' the right way to do this?
Every now and again I realize that I've developed a habit, but it
isn't the "right" or "best" way to do something, so I'm asking what
may be an obvious question.
If I am in a zsh shell script (not interactive) and want to have it do
something tangential which does not block the progress of the
main/parent script, then I usually put it in (parentheses) with a & at
the end of the line
So, to use a dramatic example:
#!/bin/zsh -f
echo "This is the start"
( find / -type f -print > /tmp/filelist.txt ) &
echo "This is the end"
exit 0
My intention is that the script would exit long before `find` was done
writing to '/tmp/filelist.txt'.
Question #1: Would it be better for any reason to use `&|` such as:
#!/bin/zsh -f
echo "This is the start"
( find / -type f -print > /tmp/filelist.txt ) &|
echo "This is the end"
exit 0
or is the use of `&|` really only beneficial for interactive shells?
Question #2: Are there better ways of doing this?
Thanks!
TjL
Messages sorted by:
Reverse Date,
Date,
Thread,
Author