From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15084 invoked by alias); 14 Jan 2013 15:32:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17562 Received: (qmail 10178 invoked from network); 14 Jan 2013 15:32:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130114073236.ZM6828@torch.brasslantern.com> Date: Mon, 14 Jan 2013 07:32:36 -0800 In-reply-to: Comments: In reply to rahul "Re: array prepend" (Jan 14, 10:18am) References: <50EFB80D.30002@sergio.spb.ru> <22417.1357954693@thecus.kiddle.eu> <20130113185141.4394d532@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: array prepend MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 14, 10:18am, rahul wrote: } } I was wondering what the way for inserting into an array is. Is the } following the simplest or most direct way: } } $FOO[1,2] xxx $FOO[3,-1] Probably FOO[N]+=(xxx) Note this is distinct from FOO[N]+=xxx which will string-append xxx to the value stored at $FOO[N]. It'd be nice if this generalized to FOO[N-1]=(yyy) for prepend, but it breaks at FOO[0] for backwards-compatibilty of $FOO[0] references and also with the KSH_ARRAYS option where indexing is zero-based. Also you must take care with subtraction because of negative indices wrapping to the end of the array. } I'd also like to know what the vision for zsh is. Are there any major } changes or enhancements coming up ? Is it to become more of a programming } language or only seen as a glue language. Well, neither really. Zsh isn't a language, it's a shell. It's meant primarily to be used interactively; a lot of the features are present only for the sake of making interactive use more powerful/customizable. The language is closely tied to what's now standardized as the POSIX shell language syntax and it's not going to stray too much farther from that than it already has, if only because we're running out of syntax that doesn't already have other semantics. To the extent that POSIX shell language is a "glue language," that is what zsh's language is likely to remain. } I've been writing an app in zsh and totally loved the experience (as } against previous experiences with bash). (However, the only thing that } keeps biting me here and there are spaces in filenames for which I do } use the @F notation. I only wish that behaviour would be a default } since the syntax is very cumbersome) Zsh's default behavior is to NOT split the string value of parameters on spaces, so unless you set the SH_WORD_SPLIT option the need for @F should be pretty small. Of course it depends on what you're doing with the file names, whether you're attempting to port a bash script, etc.