From: david sowerby <d_sowerby@yahoo.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: variable/array element question
Date: Mon, 19 Sep 2011 13:22:27 -0700 (PDT) [thread overview]
Message-ID: <1316463747.16563.YahooMailNeo@web36607.mail.mud.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 842 bytes --]
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.
-------------------------------------------------------------
next reply other threads:[~2011-09-19 20:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 20:22 david sowerby [this message]
2011-09-19 21:15 ` Benjamin R. Haskell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316463747.16563.YahooMailNeo@web36607.mail.mud.yahoo.com \
--to=d_sowerby@yahoo.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).