Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: =() and &! don't go together?



[>workers]

On Aug 28,  5:19pm, Peter Stephenson wrote:
}
} On Thu, 25 Aug 2011 13:22:09 +0200
} Stepan Nemec <stepnem@xxxxxxxxx> wrote:
} > It looks like when &! is used (i.e., "program =(computation) &!"), the
} > temporary file created by =() does not exist at the point the command
} > tries to access it. Is there a solution to this?
} 
} I think the basic problem here is that =(...) uses a temporary file, and
} if you've told the shell to forget about the process it's just created
} there's nothing to tidy up the temporary file.  I would have guessed it
} would simply not tidy up the file at all, however instead it seems it
} tidies it up even before it's used, which doesn't seem particularly
} useful.

It's not precisely the case that the file is tidied up before it's used.

	cat <=(echo foo) >bar &!

will copy "foo" into bar even though the tempfile is removed.  Depending
on the program used in place of "cat", <=(...) may be superior to <<(...)
because the former is seekable whereas the latter usually isn't.

There are similar "temp file is removed too soon" problems with other
shell constructs.  I'm not sure that abandoning the file in this one
special case is the right thing.
 
} You can work around both problems with
} 
} (program =(computation)) &!

Or { ... }&! too.



Messages sorted by: Reverse Date, Date, Thread, Author