zsh-users
 help / color / mirror / code / Atom feed
* Getting the name of zsh-generated temp file?
@ 2003-05-05 11:04 Lloyd Zusman
  2003-05-05 13:36 ` Zefram
  0 siblings, 1 reply; 5+ messages in thread
From: Lloyd Zusman @ 2003-05-05 11:04 UTC (permalink / raw)
  To: zsh-users

I'm using zsh 4.1.0-dev-5.

Within a zsh script, is there any way that I can get the name of the
temporary file generated by the =(...) construct?

One of these is left sitting around in /tmp after each termination of
one of my zsh scripts, and I'd like to remove it.  If the script could
retrieve that file name, I could make sure to remove it before the
script exits.

Thanks in advance.

-- 
 Lloyd Zusman
 ljz@asfast.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting the name of zsh-generated temp file?
  2003-05-05 11:04 Getting the name of zsh-generated temp file? Lloyd Zusman
@ 2003-05-05 13:36 ` Zefram
  2003-05-05 13:50   ` Lloyd Zusman
  2003-05-05 16:57   ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Zefram @ 2003-05-05 13:36 UTC (permalink / raw)
  To: Lloyd Zusman; +Cc: zsh-users

Lloyd Zusman wrote:
>Within a zsh script, is there any way that I can get the name of the
>temporary file generated by the =(...) construct?

$ foo==(echo bar)
$ echo $foo
/tmp/zshp8oWrV
$ cat $foo
bar

-zefram


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting the name of zsh-generated temp file?
  2003-05-05 13:36 ` Zefram
@ 2003-05-05 13:50   ` Lloyd Zusman
  2003-05-05 16:57   ` Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Lloyd Zusman @ 2003-05-05 13:50 UTC (permalink / raw)
  To: zsh-users

Zefram <zefram@fysh.org> writes:

> Lloyd Zusman wrote:
>>Within a zsh script, is there any way that I can get the name of the
>>temporary file generated by the =(...) construct?
>
> $ foo==(echo bar)
> $ echo $foo
> /tmp/zshp8oWrV
> $ cat $foo
> bar
>
> -zefram

Thanks.  That works great.  And it's so obvious ... in hindsight. :)

-- 
 Lloyd Zusman
 ljz@asfast.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting the name of zsh-generated temp file?
  2003-05-05 13:36 ` Zefram
  2003-05-05 13:50   ` Lloyd Zusman
@ 2003-05-05 16:57   ` Bart Schaefer
  2003-05-05 18:27     ` Lloyd Zusman
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2003-05-05 16:57 UTC (permalink / raw)
  To: zsh-users

On May 5,  2:36pm, Zefram wrote:
} Subject: Re: Getting the name of zsh-generated temp file?
}
} Lloyd Zusman wrote:
} >Within a zsh script, is there any way that I can get the name of the
} >temporary file generated by the =(...) construct?
} 
} $ foo==(echo bar)
} $ echo $foo
} /tmp/zshp8oWrV
} $ cat $foo
} bar

It should be pointed out that assigning the =(...) expression to a variable
is meant to be the only way to get the temporary file to persist.  In all
other cases (and, in older versions of zsh, even for assignments) the file
is automatically removed as soon as the surrounding expression completes.

Lloyd originally wrote:
> One of these is left sitting around in /tmp after each termination

In short, This Should Not Happen unless zsh is crashing or you are doing
something unusual to cause the file to be left behind.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting the name of zsh-generated temp file?
  2003-05-05 16:57   ` Bart Schaefer
@ 2003-05-05 18:27     ` Lloyd Zusman
  0 siblings, 0 replies; 5+ messages in thread
From: Lloyd Zusman @ 2003-05-05 18:27 UTC (permalink / raw)
  To: zsh-users

"Bart Schaefer" <schaefer@brasslantern.com> writes:

> It should be pointed out that assigning the =(...) expression to a variable
> is meant to be the only way to get the temporary file to persist.  In all
> other cases (and, in older versions of zsh, even for assignments) the file
> is automatically removed as soon as the surrounding expression completes.
>
> Lloyd originally wrote:
>> One of these is left sitting around in /tmp after each termination
>
> In short, This Should Not Happen unless zsh is crashing or you are doing
> something unusual to cause the file to be left behind.

I am using 'exec' to invoke a different executable from within my zsh
script.  I think that this is preventing the temp file from being
removed.  I have control of the other executable, and so I now can pass
the name of the temp file as an argument to this executable, who now
explicitly removes it.

And I should add I deliberately want to replace my script with the other
executable, which is why I'm using 'exec'.

-- 
 Lloyd Zusman
 ljz@asfast.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-05 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-05 11:04 Getting the name of zsh-generated temp file? Lloyd Zusman
2003-05-05 13:36 ` Zefram
2003-05-05 13:50   ` Lloyd Zusman
2003-05-05 16:57   ` Bart Schaefer
2003-05-05 18:27     ` Lloyd Zusman

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).