background foreach in csh or for in sh?

Paul Falstad pfalstad at phoenix.Princeton.EDU
Mon Mar 25 13:47:12 AEST 1991


gwoho at nntp-server.caltech.edu (g liu) wrote:
>how do i do a foreach or for in the background without
>writing a script file or explicitly running a new shell
>or something complicated like that??
>is there a simple way to do it?

sh:

for i in whatever
do
...
done &

(just stick an & after the done)

I tried various ways to do this in csh, including putting the whole thing in
a subshell explicitly and putting \'s at the end of every line, or
embedding control-J's in the line, but it wouldn't work.  There might be
a simple way, but who cares?  Use sh anyway; its behavior is much more
predictable and reliable than csh's, especially for shell scripts.

--
Paul Falstad, pfalstad at phoenix.princeton.edu | 10 PRINT "PRINCETON CS"
[Your blood pressure just went up.]          | 20 GOTO 10
Princeton University would like to apologize to everyone for this article.



More information about the Comp.unix.questions mailing list