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

Re: Get the result of the last glob



What’s top posting?

Can’t $lastglob be available in the same command? It would be in the same fork, I imagine …
`command * -d $lastglob`

> On Aug 22, 2019, at 1:24 AM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> 
>> On 8/21/19, Aryn Starr <whereislelouch@xxxxxxxxxx> wrote:
>> Thanks. I needed this to be non-interactive, and I indeed created a function
>> for it, I was just wondering if it was possible to get the glob in a magic
>> variable or sth, which it seems it is not.
> [don't top post]
> 
> Yes, it's not possible to get anything like $lastglob, because globs
> are expanded after forking¹ to run the external command, so no results
> are available to the interactive shell for subsequent use.
> 
> ¹ if you're not running an external command it would theoretically be
> possible, but it would be an inconsistent interface.
> 
> -- 
> Mikael Magnusson


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