From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2674 invoked from network); 4 Feb 2023 00:22:06 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Feb 2023 00:22:06 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1675470126; b=Mfd4qqsEE8v9m/Suyujm8AmblLwEto0jaMpUptkJ55k6I2qfrtl4lKAvXU48pzC1IPnVSQk7gh fy+BRaJa0ZmpUW9+pP8DPjDQKUPSb2RPIVtRjzh5dN4B8rR7078b/kFfkLqjX9uce0gpyjNVXL +MMMgNZ6IeMkUTatHxDNbzLNxFn0xdb347KK6lIWZEqj+/1t3JBPPPTAn1e0135VE3UjWIOhH9 QQPAC0bHE74YNDH+rqqwISh8voHGPrggeQK2f6SbIMeXNH9DM8jvae/HwKofrzwBTYNgFGZ6xI +3RR5u1JG/s077rAXZN6XczfB+jjC66wophAidVAwqnhRg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (01b.relay.hey.com) smtp.remote-ip=204.62.114.225; dkim=pass header.d=hey.com header.s=heymail header.a=rsa-sha256; dmarc=pass header.from=hey.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1675470126; bh=kn7hpXJRPO+rCL0YTcd6CuXc/eJTzBs7/+ARV6f2zFE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject: In-Reply-To:Message-ID:To:From:Date:DKIM-Signature:DKIM-Signature; b=GUjSITehQAEEoMWCLNQBLIrNjaoDGFKDO2JSLElO+MFOktq4zvCfEdHc3j8swRLVjSLpPdfvs3 BuqjEn2uaYbkE20RVbxVVkEhMI5E05QLxB+Ed4WX31lPexx6P5VXJ9rTo2TXWrtN7S1xSHYTjD ycy++wo4WSFMLtS2RvH5n7kj8Em8uvBT5NzrIzzZYtExR2EEmLy2+5lOxvx/jvSj1rjiEaEp/M o1iySwKvWaKpn9jAbHd8U9cDbqBBl/TzI6u4ye5oNioO2U76Ff6Gbdhl8ciU6AL24hW8DsiDrm wa5s9SzcZ56WPJn940zOmExX5iRxzVWvR9otFxCVLtMQcA==; 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:Content-Transfer-Encoding: Content-Type:Mime-Version:Subject:In-Reply-To:Message-ID:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References; bh=Likspqj6qAkuXMNm2ZoDuzqU+Dj2e4+V6NxxdlitgiA=; b=FB9wzgOoEkM3VleVetfveDyxau 7Z+O0SqDSCBg3yhyMULGlrVBX/iVOuhxbRS7xptjqlk2g7MgYs2yBcwoYTBP6ylDcfvnhD6GSfxeO yZ0+nOjaOjnrvILAU/iJ0FFG4p8xQaShz5RA9E6z8shqe7nbAafuh8VG1Ap9SQIOxTs2C3eKRUTCt WfZ8MmHcDrMWOMFuoCOC2LMIl4NGHiYRBJkDfs4huNNPzqvJYbK9PFQjw3gF92/d0umVQAWVNz+B7 QvXCG8WpHrwfeDbTxSc74/8zejyTb9xUzmGMJt6HZnAFGDDdalW+9oczaDibQVkBH7b8qsETGrArg KID/U2Ig==; Received: by zero.zsh.org with local id 1pO6Jh-0007Su-HC; Sat, 04 Feb 2023 00:22:05 +0000 Authentication-Results: zsh.org; iprev=pass (01b.relay.hey.com) smtp.remote-ip=204.62.114.225; dkim=pass header.d=hey.com header.s=heymail header.a=rsa-sha256; dmarc=pass header.from=hey.com; arc=none Received: from 01b.relay.hey.com ([204.62.114.225]:51297) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pO6Hu-0006jB-IE; Sat, 04 Feb 2023 00:20:15 +0000 Received: from hey.com (bigip-vip.rw-ash-int.37signals.com [10.20.0.24]) by 01.relay.hey.com (Postfix) with ESMTPS id 06114C1B20; Sat, 4 Feb 2023 00:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hey.com; s=heymail; t=1675470013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to; bh=Likspqj6qAkuXMNm2ZoDuzqU+Dj2e4+V6NxxdlitgiA=; b=YJLwQIXFRwaTtPI5Avngo1zp51rbZ2oJqbf3ncmNUB/4XDCrhdAFL+pMLPEsDrU1Xo2No8 4gjGqJxC8yl/1zFeREexfhfGrkIvINPNtqIuMQpYhaihKty88Yn3mF96XOlKuHTZ9arzKy QQzxjOVCX+zR3XObvgUrd/B6cm6sptmjKeEcA8NTcQbaSGK1VxhXWynvBqZMEdJOR7la20 EsiFLKcdz7Qbb5s9ehNrkIoVbTIDEC2ub5MXaHYu6UlOgAbe7UHZ40ITGdc4G4n2xd8P26 16sBGl9gsBZSu+2YAkFUYdHsXnUnB6lobq/DrlhBx/E6QzidnczI2rVPKL8AJw== Date: Fri, 03 Feb 2023 19:20:12 -0500 From: Eric Nielsen To: "zsh-users@zsh.org" , sergio Message-ID: <6e1b26963200efd1c6e7ed9a0dd976ded1ab72c9@hey.com> In-Reply-To: <81c93630-34fd-7e2d-39bb-e5f8cc5b344e@outerface.net> Subject: Re: join a string with a parameter value if it's not empy Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_63dda4bc8424d_311d9c8141a"; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Seq: 28895 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: ----==_mimepart_63dda4bc8424d_311d9c8141a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit > p='value' -> result: 'value_string' > p='' -> result: 'string' A simpler variation of your first solution: $p${p:+_}string -- Sent with HEY ----==_mimepart_63dda4bc8424d_311d9c8141a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> p=3D'value' -> result: 'value_string'
> p=3D'' ->= result: 'string'

A simpler variation of your first solution:
<= br>$p${p:+_}string


--
Sent with HEY
----==_mimepart_63dda4bc8424d_311d9c8141a--