From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13218 invoked by alias); 25 Feb 2017 17:02:40 -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: 22493 Received: (qmail 13521 invoked from network); 25 Feb 2017 17:02:40 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(0.5/5.0):. Processed in 1.273222 secs); 25 Feb 2017 17:02:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=di5J=2G=brasslantern.com=schaefer@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at bounces.park01.gkg.net does not designate permitted sender hosts) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=bB+T4A4UYIKbIMT1U6Od5rsGZWei3LNmtdsxRVsypTU=; b=sGv4dLbn4RH7zS0eH32u3fWH3jxFwuMKznVLzNMTBYYRqnOAAJXlP0R4/az9T3bIRa CsfwTmRF5ZSuf9voDCPfL3hkgl7f2ruZDrT5v/KvNwJ5gR+gNTXvqcAbcPoMdSWsrqpA xWx56yPxosJeKW23UE4MDccfruPg8p2isPjCRHpK573XlScjMkm3GLhD4eJnKgO8HcdG z3R6Z/yrfuJ2IFACMzrmjPhR+Qiim0069/r3wixMm93dafAIG9XYBxD6/FSWyaHTMl1v Qg6eu+coWJDQ+5459nnQ/1cB4eF5SiCAMEYKtKXJrpFJSsEJdkKN9ZJeYH+8kRIta6y7 NrjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=bB+T4A4UYIKbIMT1U6Od5rsGZWei3LNmtdsxRVsypTU=; b=ZOM/YbzvxMMkfldcI3FP5IvkTZqAxXwKWWNDqElxFHGDVcsAXK4/PY/cJTGzVuMKQM GInYqLcwUkjtvYJpUbOAtBayolReZR+iECjK9ff6e/dEfIZgjbkkp43Ipxt37fk5MwYr SczuV9u6XPJ+I+r2T9iQ6UjxyC0KkpryIDW+TXDFp3X7GvNxTx2fssTqEa7WJodnOWXv zXFNaNADJXcXWRAtRD9ZqRUD+YZRWHlf9ubJ0gHs0IkGgkt3PpA3TgZ53JcXmtw8fMx2 p5cn4kCgJ4v54CSHcNu3CbCOMRZqhwT6KuiTcUe1lyCUdrZClNQ4pKosWwR5iSDeMVEf Lolg== X-Gm-Message-State: AMke39ljJ1KR3bKVJ9pOMDEcsLw7Etkbjfy0fvwDUkYp3+yjEfx02KM6leYCkai96AZcXg== X-Received: by 10.31.85.4 with SMTP id j4mr3455000vkb.1.1488042129523; Sat, 25 Feb 2017 09:02:09 -0800 (PST) From: Bart Schaefer Message-Id: <170225090218.ZM22334@torch.brasslantern.com> Date: Sat, 25 Feb 2017 09:02:18 -0800 In-Reply-To: <32f48d32-2b11-045e-5925-8f112783f1e2@eastlink.ca> Comments: In reply to Ray Andrews "Re: bash conversion trouble." (Feb 25, 8:24am) References: <004ec4f2-3b3a-8907-86a6-4326399783aa@eastlink.ca> <170224204153.ZM19840@torch.brasslantern.com> <6f722b8f-a712-985f-65e8-3b03a5b352c3@eastlink.ca> <170225075521.ZM22115@torch.brasslantern.com> <32f48d32-2b11-045e-5925-8f112783f1e2@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: bash conversion trouble. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 25, 8:24am, Ray Andrews wrote: } } Just curious: why would that have been changed? This comes from zsh's original heritage as a bourne-shell-like shell intended for students who were trained on BSD csh. Also this happened before ksh was widely available outside an AT&T research lab so there was no bourne-shell array syntax to "change". Exactly why csh adopted 1-based arrays is probably lost to history at this point, but I suspect the argument goes something like this. When invoking a script e.g. "prog this is a test", internally $0 is "prog" and the arguments are $1 = this, $2 = is, etc. Therefore when referring to the positional paramters, counting always starts from 1. Consequently it "makes sense" to have other arrays also count from 1, so that e.g. newarray=("$@") if [ "$newarray[1]" = "$1" ]; then echo copied correctly; fi It's strange to have to adjust thinking to zero-based for other arrays when the most obvious default array seems to start at 1.