Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature request: set extension for =( ) created file
On 25 September 2016 at 07:17, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> However, neither that nor any of your suggestions would accomplish
> altering the filename based on the file content. The file has to be
> created in the parent shell before the command is even run, so that
> it can be opened as the command's output; and I would not advocate
> having the shell peering at the content without being explicitly
> scripted to do so.
Yes yes I was surprised my post could be understood as peering at
content. It's like in the git example: extension is known (is obtained
from git ls-tree, just like SHA of the BLOB), and can be provided to
=( ) which runs command that accesses the content. Other example:
downloading a HTTP address, having Content-Type available, knowing
what the extension should be. And a standard situation: creating
specific content for specific program expecting specific, known
extension (a case if only it's not typical and of course common less
program, it's part of my point in general: "what programs do not use
extensions?").
First thing that came to my mind is use of [], not () like Nikolay
proposed, so e.g. vim =( cat ... )[java], although it also suffers
from colliding with globbing, which is IMO a serious drawback.
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author