Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bash conversion trouble.



On Feb 25, 11:13am, Ray Andrews wrote:
}
} Interesting.  So bash and ksh went one way an zsh and csh went the 
} other.  Obviously the decision was made in the context of the time, but 
} I'd have expected zsh to go with bash.

The point is that zsh "went" before there were arrays in bash to follow.
"I'd have expected gorillas to be the same color as orangutans."

} One hears nothing but bad things about csh.

Yes, the intent of zsh was to take only the good things from csh and for
everything else be like the Bourne shell (which is NOT "like bash", nor
is it even "like POSIX" which came even later).

Various extensions for bash/ksh compatibility were then added to make
it simpler to do exactly the kind of script conversion you're currently
working on, and to help people migrating from bash et al. in the same
way that the original design was meant to assist people migrating from
csh.

} Yeah, why not just use natural counting?   That array[9] is the tenth
} element has always seemed a bit dumb but I'm used to it from C.

In C it makes sense because arrays are based on pointer arithmetic so
array[0] == *(array+0) == the start of the array.  Shells don't have
such pointer arithmetic, at least not exposed by default.  That's even
the reason that $0 == the program name, because in the underlying C
the 0 element of the array passed to execve() is the program name.



Messages sorted by: Reverse Date, Date, Thread, Author