[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flaw in %readfrom and %writeto



Harald Hanche-Olsen wrote
> #	All that, for example, the /tmp version of %readfrom does is bind
> #	the named variable (which is the first argument, var) to the name
> #	of a (hopefully unique) file in /tmp.
> 
> However, the uniqueness fails in some cases, as in the following example.

Yep, that's right.  Don't most systems support /dev/fd these days,
making the temp file kludge less necessary?

> I actually never understood why $pid does not change in a forked subshell,
> but that's a different matter.

So you can do things like

  { mumble > /tmp/poot.$pid } &
  rm /tmp/poot.$pid

and have them work on the same file.  Behavior inherited from /bin/sh.

--p