Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: In POSIX mode, ${#var} measures length in bytes, not characters
- X-seq: zsh-workers 35408
- From: ZyX <kp-pav@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: In POSIX mode, ${#var} measures length in bytes, not characters
- Date: Sun, 07 Jun 2015 04:27:50 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1433640471; bh=QLHq+StC92Qr0xtskV9uY5j0OFMFK7PDsjljUpLTjfo=; h=From:To:In-Reply-To:References:Subject:Date; b=o9OtuTLLKNgyoULbO3Hsvv1QIXQkr/PxpaVRTBRbufCcof080lbWcYH1yGo26hbbJ x26MzWyK9W+KV2qpZ5VaWndj5buIZcPP5hdSFvlplqjiVscCLxMrxjXgUjahreVVKG jAASpuNSIIuNWbL++O8PVv5eZoVyWKrH6ZjX8lG8=
- In-reply-to: <150606182318.ZM692@torch.brasslantern.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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <55738EFE.1050805@inlv.org> <6697841433637291@web4o.yandex.ru> <150606182318.ZM692@torch.brasslantern.com>
07.06.2015, 04:24, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>:
> On Jun 7, 3:34am, ZyX wrote:
> } Subject: Re: In POSIX mode, ${#var} measures length in bytes, not characte
> }
> } 07.06.2015, 03:29, "Martijn Dekker" <martijn@xxxxxxxx>:
> } > When in 'emulate sh' mode, ${#var} substitutes the length of the
> } > variable in bytes, not characters. This is contrary to the standard; the
> } > length in characters is supposed to be substituted.[*]
> } >
> } > Oddly enough, zsh is POSIX compliant here in native mode, but
> } > non-compliant in POSIX mode.
> }
> } Do you have a reference where "character" is defined? This behaviour
> } is the same in posh and dash:
>
> I thought this was discussed on the austin-group list but I can't find a
> search term to dig it out of the archives. (I did find the thread about
> ${##} as a side-effect of the attempt.)
>
> On my Ubuntu 12.04 system, /bin/sh is a link to dash, so zsh invoked
> as sh behaves like /bin/sh. On CentOS, /bin/sh links to bash, so they
> behave differently.
Just checked out busybox (ash), it also emits 2 (recognizes unicode codepoints). Ksh emits 2, mksh 4.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author