Zsh Mailing List Archive
Messages sorted by:
Reverse Date
,
Date
,
Thread
,
Author
Re: join a string with a parameter value if it's not empy
X-seq
: zsh-users 28897
From
: Eric Nielsen <ericbn@xxxxxxx>
To
: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>, sergio <sergio@xxxxxxxxxxxxx>
Subject
: Re: join a string with a parameter value if it's not empy
Date
: Fri, 03 Feb 2023 19:23:57 -0500
Archived-at
: <https://zsh.org/users/28897>
In-reply-to
: <
81c93630-34fd-7e2d-39bb-e5f8cc5b344e@outerface.net
>
List-id
: <zsh-users.zsh.org>
> p='value' -> result: 'value_string'
> p='' -> result: 'string'
A variation of your first solution:
$p${p:+_}string
I don't see how it could be significantly simpler than this.
--
Sent with
HEY
References
:
join a string with a parameter value if it's not empy
From:
sergio
Messages sorted by:
Reverse Date
,
Date
,
Thread
,
Author