Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
variable/array element question
- X-seq: zsh-users 16386
- From: david sowerby <d_sowerby@xxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: variable/array element question
- Date: Mon, 19 Sep 2011 13:22:27 -0700 (PDT)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1316463747; bh=Zyu9PL4+6q64u49OS/J2C4kdEia/Tpz8/0T40CXnmTk=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=QDQlZCkHG8CYsChIZC+GRDUB4sSuZzf7Z+JRXs2liz2J0vUWUGuuqh9va7t2q07nl3Ha2/KTnXhJEn7/6IuxS5M7IyzEuoAJoa+q1jNNv4wxqk2Z5xZOwZPhOp6GVlXNNRVnQlBC986x1SoLPbzd0Rl2eI2NpfA8Br1gykc803Q=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=hQX+VVYqDH4Ixjc8M9PuZ+nLJcRA3BkKM5j7WVkU8Cnj2IzF3jYmcFhrQ3hqpiZM6cNAdcEZCkerJ5aeroJgL0sKCOkux6g39xKfeOoKAzqt2xG4xyatMcAcPg5Yf8Q6uucdmQ+pG4LKru+SHW8ma6eJ3pFmZXmJm5GNpJ+Ocqc=;
- 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
- Reply-to: david sowerby <d_sowerby@xxxxxxxxx>
I did array=( $(ls -l <file>) )
print $array
and got an error Hmmmm......
did print ${array[2,9]} and got the expected result: elements 2-9
so zsh didn't like the first element
Experimenting I did
ls -l <file> | while read one two three four etc ; do print $one $two $three ; done
same error
So after using zsh for 2 years , I've just discovered that it doesn't like variables to start with '-' .
Obviously I can use Awk for this example, but I was curious as to why this is?
I have bash and dash installed and neither have a problem with '-', don't have ksh so don't know about it.
Thanks in advance of the answer -----------------david
-------------------------------------------------------------
Veloci-rapture - when dinosaurs go to heaven.
-------------------------------------------------------------
Messages sorted by:
Reverse Date,
Date,
Thread,
Author