From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20055 invoked by alias); 25 Sep 2016 15:22:06 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21975 Received: (qmail 9996 invoked from network); 25 Sep 2016 15:22:06 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.26):SA:0(0.0/5.0):. Processed in 0.388949 secs); 25 Sep 2016 15:22:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: larryv@macports.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at macports.org does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=r9ISZ0wzrX3Wi9W jbLP8fKZ6FtQ=; b=e9cp6KysG/GFAX8k95HoB4SOaOIT6EhvG24snhh7HHjKCfq 5tCF+TZDsP7ur9V8Ljo8ZuyHoXdExzTGqvlHTV3cLmyJ6C+rgiFcMFLBce40iOHv 4P1d0B5B+DSUhFLJ9RimHSbX++zlttYzXrKWL2Wu8XCqIXr4SMPgS9TCmmGU= X-Sasl-enc: q7h999oWOAW73d3PbdE+YsQs2dP4mhUmZ48sxafJT4I6 1474816919 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Feature request: set extension for =( ) created file From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= In-Reply-To: Date: Sun, 25 Sep 2016 11:21:59 -0400 Cc: zsh-users@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <4DC55226-A041-42E5-B8B1-3AB1E7E6AB53@macports.org> <1082821474761933@web24j.yandex.ru> <160924221731.ZM30342@torch.brasslantern.com> To: Sebastian Gniazdowski X-Mailer: Apple Mail (2.3124) > On Sep 25, 2016, at 2:17 AM, Sebastian Gniazdowski = wrote: >=20 > On 25 September 2016 at 07:17, Bart Schaefer = 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. >=20 > 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 > =3D( ) which runs command that accesses the content. Other example: > downloading a HTTP address, having Content-Type available, knowing > what the extension should be. According to Bart, the parent shell has to create the temporary file before executing the command inside the subshell. Unless I'm mistaken, that implies that the parent would have to inspect said command before executing it in order to decide how to obtain your suggested metadata. If the subshell contains "git cat-file", the parent shell would have to know to run "git ls-tree". If the subshell contains "curl", the parent shell would have to know to run "curl -I" first. Guessing an extension by peering at arbitrary, context-specific metadata is no better than doing so by peering at the data itself. It's just another form of content detection that would balloon into a convoluted mess and shouldn't be implemented in the shell itself. > And a standard situation: creating specific content for specific > program expecting specific, known extension Would Bart's TMPSUFFIX suggestion satisfy this use case? > (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?"). I could spend all day (or at least a minute!) listing Unix programs that don't care about extensions. This is really not a good argument. vq=