zsh-workers
 help / color / mirror / code / Atom feed
* Re: array not working
       [not found] <Xns98877CBF8A380zzappergmailcom@80.91.229.5>
@ 2006-11-26 12:53 ` zzapper
  2006-11-26 13:35   ` Nikolai Weibull
  0 siblings, 1 reply; 3+ messages in thread
From: zzapper @ 2006-11-26 12:53 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

zzapper <david@tvis.co.uk> wrote in
news:Xns98877CBF8A380zzappergmailcom@80.91.229.5: 

> Hi a previously working zsh script
> 
> #!/bin/zsh
> echo $SHELL
> dirbackup="c:/backup/mysql/"
> mysqldump="/c/mysql41/bin/mysqldump"
> param="--add-drop-table "
> server="www.someurl.co.uk"
> someurl=(database login password filename)
> 
> "$mysqldump" $param -h $server -u${someurl[1]} -p$someurl[2] -B
> ${someurl [0]} > ${someurl[3]}.sql
> 
> What is happening is that ${someurl[1]} $someurl[2] ${someurl[0]}
> 
> are all evaulating to the same value (first element in array)
> 
> zsh 4.3.2 (i686-pc-cygwin)
> 
> what daft thing am i doing?
> 
> 
Hi
Started new shell and problem went away, but arrays now seem to be
indexed from 1 rather than zero?? 

Did this change recently?


-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


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

* Re: array not working
  2006-11-26 12:53 ` array not working zzapper
@ 2006-11-26 13:35   ` Nikolai Weibull
  2006-11-26 17:56     ` zzapper
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolai Weibull @ 2006-11-26 13:35 UTC (permalink / raw)
  To: zzapper; +Cc: zsh-workers, zsh-users

On 11/26/06, zzapper <david@tvis.co.uk> wrote:

> Started new shell and problem went away, but arrays now seem to be
> indexed from 1 rather than zero??

>From zshparam(1):

       Individual  elements  of an array may be selected using a subscript.  A
       subscript of the form `[exp]' selects the single element exp, where exp
       is  an arithmetic expression which will be subject to arithmetic expan-
       sion as if it were surrounded by `$((...))'.  The elements are numbered
       beginning  with  1,  unless  the KSH_ARRAYS option is set in which case
       they are numbered from zero.

And this has, as far as I know, always been the case.

  nikolai


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

* Re: array not working
  2006-11-26 13:35   ` Nikolai Weibull
@ 2006-11-26 17:56     ` zzapper
  0 siblings, 0 replies; 3+ messages in thread
From: zzapper @ 2006-11-26 17:56 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

"Nikolai Weibull" <now@bitwi.se> wrote in
news:dbfc82860611260535s429e4464qb7f50650e7446adb@mail.gmail.com: 

> On 11/26/06, zzapper <david@tvis.co.uk> wrote:
> 
>> Started new shell and problem went away, but arrays now seem to be
>> indexed from 1 rather than zero??
> 
> From zshparam(1):
> 
>   nikolai
> 
> 

Sorry false alarm, the original script used to run under bash, which I 
guess used zero indexing



-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


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

end of thread, other threads:[~2006-11-26 18:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Xns98877CBF8A380zzappergmailcom@80.91.229.5>
2006-11-26 12:53 ` array not working zzapper
2006-11-26 13:35   ` Nikolai Weibull
2006-11-26 17:56     ` zzapper

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