zsh-users
 help / color / mirror / code / Atom feed
* variable/array element question
@ 2011-09-19 20:22 david sowerby
  2011-09-19 21:15 ` Benjamin R. Haskell
  0 siblings, 1 reply; 2+ messages in thread
From: david sowerby @ 2011-09-19 20:22 UTC (permalink / raw)
  To: zsh-users

[-- 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.
-------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-19 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 20:22 variable/array element question david sowerby
2011-09-19 21:15 ` Benjamin R. Haskell

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).