Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Is this a bug, doc error, or misunderstanding?
- X-seq: zsh-users 16676
- From: Larry Schrof <larrys@xxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Is this a bug, doc error, or misunderstanding?
- Date: Thu, 29 Dec 2011 22:50:38 +0000
- Accept-language: en-US
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : content-type : mime-version; s=facebook; bh=UrGpspJSDo9YticNma3LxJMa3g2ukW6nq7LloOB/lMA=; b=QMBmN/CVhq4j2j+WFJNt/LXEHI7mk3TfnHfLq7q/3wh5+Kogmt7RCI/z4QRrKgqZOFTR ntq/DnJe6eM/rXBS/Dxc4fk9ya1Gebtvw43Gz7Ehgyimm/ekkbP7WsE2RP5tssDSMcyo /RLmPPnk8d/fUO+W2EUR8PW5nnmfba7iwoI=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Thread-index: AQHMxnxIGVTFm2hEIEOo6/jur/S2qg==
- Thread-topic: Is this a bug, doc error, or misunderstanding?
From the zshexpn man page under 'Parameter Expansion Flags' section:
n Sort decimal integers numerically; if the first differing charac-
ters of two test strings are not digits, sorting is lexical.
Integers with more initial zeroes are sorted before those with
fewer or none. Hence the array ‘foo1 foo02 foo2 foo3 foo20 foo23’
is sorted into the order shown. May be combined with ‘i’ or ‘O’.
So that tells me that as two elements are being compared, and the sort hits the
first occurrence of two differing characters, AND those characters are not
digits, sort the entries lexiographically.
$ VAR=(ZHOST40 HOST+ host04 host4 host36)
I would expect this, using the (n) expansion flag, to sort to:
HOST+ ZHOST40 host04 host4 host36
This is because when comparing 'ZHOST40' and 'host04', 'Z' comes before 'h'
lexiographically. However, this is not what we get...
$ echo ${(n)VAR}
HOST+ host04 host4 host36 ZHOST40
It appears as if the (n) flag in this case applied an implicit case-insensitive
flag (i), which is not what I wanted.
Is this a bug in the (n) expansion flag, an erroneous explanation in the man page,
or just something fundamental thing I'm not getting?
Thanks!
P.S. Zsh version 4.3.10
Messages sorted by:
Reverse Date,
Date,
Thread,
Author