From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id ED4BA267FE for ; Fri, 8 Mar 2024 23:15:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=nOD45UjX1QA9M3Kax11kuqxL/DazLrEX7gYJLeimBXE=; b=e9LNkr90G6bGeOYG2/w7NtvsOr Movd1mpODT9xuT1VHsZ8+8EeTuwneQqPP7e/xmOUqfjndyjicp1dVyGRAaVLmjGX3eGVmohCAKSeP U0q+q7NLH1nx9xR7RWSMz7uv/fN2I0o0KO37yFG0wU++KvubvZGVaa2Xgh80Wcf5/jb40dS1ArH5e E5MhJ/C2mcmdAwgiiF8JmjRdPZSv1UkItgaVKR/5jJd/d3el3sZr2ZU8DVXzmfXrYCyj450cxMLnO DdNGWOIakvkcbebguAfGWmwL99k2TJMpb8FsrkSFBYIwfx2z3wSk2qTZ48et4Twbq3EKWfnFXQDhs fK+l6BXw==; Received: by zero.zsh.org with local id 1riiUq-000FBv-U5; Fri, 08 Mar 2024 22:15:20 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1riiUZ-000Ese-Jd; Fri, 08 Mar 2024 22:15:03 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.97.1) (envelope-from ) id 1riiUY-00000000NbL-0NVD; Fri, 08 Mar 2024 23:15:02 +0100 cc: zsh-workers@zsh.org In-reply-to: From: Oliver Kiddle References: <20240305065606.ccr2ieheahslcpye@chazelas.org> <20240306175711.t3uz2sery3b6tbjw@chazelas.org> To: Bart Schaefer Subject: Re: [PATCH?] Nofork and removing newlines MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <90725.1709936102.1@hydra> Date: Fri, 08 Mar 2024 23:15:02 +0100 Message-ID: <90726-1709936102.086878@xlWC.oGpX.V4Q4> X-Seq: 52716 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Bart Schaefer wrote: > ${< should be reserved for reading a file, as already suggested > elsewhere (no, I'm not going to implement that yet, though it seems to > be an undocumented ksh93 feature). > ${> might work, but it "looks wrong" to have a command instead of a > file to the right of the pointy end. I agree. I'd sooner expect that to be running $NULLCMD redirected to a file. Not that that would be even remotely useful. > Every other character already has another meaning in that position, as > far as I can tell. It could be nice to have ${= cmd } as a shorter alternative to ${=${ cmd }} particularly if the default is to be newline preserving. That would need to do word splitting but trailing IFS characters also get removed so it would work for some cases. > There is one other possibility: ${||command}, that is, > ${|var|command} with an empty var name. That's already passed through > the lexer, so it could be picked out at the necessary place in subst.c > (I think, haven't actually tried yet). It looks a little odd, too, > given "||" usually means "or", but it's at least sort of logical to > treat "assign this output to nothing" as "return the output in place", > and the other ${|...} forms do preserve trailing newlines. The logic does at least follow from the usage with a variable. One way to avoid the resemblance to an "or" is if ${| |command} also works. It could perhaps be combined so ${||