From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16614 invoked by alias); 22 Dec 2011 23:42:56 -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: 16662 Received: (qmail 15798 invoked from network); 22 Dec 2011 23:42:55 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.eastlink.ca designates 24.224.136.30 as permitted sender) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed X-CMAE-Score: 0 X-CMAE-Analysis: v=2.0 cv=e/t9udV/ c=1 sm=1 a=F38gBR/N/Qdjpq1b3FW1JA==:17 a=WgCWZe6VrWMA:10 a=8nJEP1OIZ-IA:10 a=AwXaD8D8gzTBAOr8K1gA:9 a=wPNLvfGTeEIA:10 a=Y4g+zi6NJtbRuBVJrbSZ6Q==:117 Message-id: <4EF3C07B.4040604@eastlink.ca> Date: Thu, 22 Dec 2011 15:42:51 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101218 Thunderbird/3.1.7 To: zsh-users@zsh.org Subject: '$1' indexing. References: <20111218101116.GA4446@miek.nl> <20111222230108.GA32237@miek.nl> In-reply-to: <20111222230108.GA32237@miek.nl> Hi! First post. I thought I'd try zsh given how well spoken about it is. My first exercise has been to try to convert my bash functions to zsh, and it has not gone smoothly, but most problems have proved to be solvable. But what do you guys think of this: function z { var=$1 echo "var:/${1:0:1}/${1:1:1}/${1:2:1}/" echo "var:/${var:0:1}/${var:1:1}/${var:2:1}/" } $ z abcde var: /a/a/b/ var: /a/b/c/ Surely the indexing of '$1' is wrong? I can assign the value to 'var' and all is well but I don't think I should have to. Thoughts?