Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Issue with string slices
- X-seq: zsh-workers 44427
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: Issue with string slices
- Date: Tue, 18 Jun 2019 19:12:00 +0100
- Cc: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>, joão marcos pereira bezerra <marcospb19@xxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=E7HT0xViJ1nBW8Rk8LW8MKputMZ272nzbsQVvcZ+rVU=; b=MXr/LRsEIwUBdYLZqMj7zJu4TNw4oEGEmB+eDvRAZ7p/9dgcQe1+LDAcPYrdU57/QB umqUVlGBRQft9OQnoe2zgNHm9XTXunLEMvUpWfUH1BfvfnUdwqwW//L04ZXxW1GgCPtS HDZWNRTPUcq4ppxH/ze8WYFmaKcvNHCGWZXErDISt3htV2cmrdFimzDa+hfjs622u5Fq g8WaqUn4Vz/QNuTgpUrv1OX0YvUnCWiM5ENm9auq4KA7+F8h5/XZb2Cx4JV0etdTL4i0 QXIdPYDPrZ+EjcV7fGStVJEFpR88dOjTBB3I+Lbzf+z1DhPcKKZ5p/k7M680K3+G1OrH 7kWA==
- In-reply-to: <CAN=4vMraKuGp0=Rs839sD+BdGhpo6kmpoeL9+kRy4_gOJ53-wA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Peter Stephenson <p.stephenson@xxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>, joão marcos pereira bezerra <marcospb19@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20190617083759epcas1p11383850c11184f54e3a0b822c9ea12e6@epcas1p1.samsung.com> <RO1P152MB0841421B113C0DFAFF91832AD4EB0@RO1P152MB0841.LAMP152.PROD.OUTLOOK.COM> <1560761469.6175.1.camel@samsung.com> <CAN=4vMraKuGp0=Rs839sD+BdGhpo6kmpoeL9+kRy4_gOJ53-wA@mail.gmail.com>
2019-06-17 11:05:32 +0200, Roman Perepelitsa:
> To print $something as is, use one of these forms:
>
> echo -nE - "$something"
> print -nr -- "$something"
> printf '%s' "$something"
>
> The first two are ZSH specific, the last is portable. ZSH also allows
> you to omit quotes here unless SH_WORD_SPLIT option is set.
[...]
The second one comes from ksh, it's not zsh-specific and
predates POSIX, let alone POSIX's printf, but nowadays is not as
portable as printf.
If you want to target zsh and ksh only, "print" may be more
desirable as there are still some pdksh derivatives where printf
is not built-in.
"unless SH_WORD_SPLIT *or GLOB_SUBST* is set"
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author