From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9853 invoked by alias); 17 Nov 2012 21:40:38 -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: 17403 Received: (qmail 11970 invoked from network); 17 Nov 2012 21:40:26 -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) X-Authority-Analysis: v=2.0 cv=TNAd0CZa c=1 sm=1 a=bWgGDZnfoeonEsxmbE2SBg==:17 a=-1ZKr4ocusoA:10 a=-CmW0uhpTtAA:10 a=8nJEP1OIZ-IA:10 a=2MIPR_Pn71DWz3NQdD8A:9 a=wPNLvfGTeEIA:10 a=bWgGDZnfoeonEsxmbE2SBg==:117 Message-id: <50A7FD3C.9070306@eastlink.ca> Date: Sat, 17 Nov 2012 13:10:20 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-version: 1.0 To: zsh-users@zsh.org Subject: ${var: -1:1} vs. ${var:-1:1} Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit I just wasted an hour trying to extract the last character from a string. My problem was that I did: "${var:-1:1}" and didn't put a space in front of the minus sign. Bash has the same problem, so this isn't a zsh specific issue, but I'd feel a lot better if someone could explain why that space is necessary. All the shells seem to have these little gotchas with spaces. Sometimes they're ignored, sometimes mandatory and sometimes forbidden. It sure is a PITA. I can only compare this to C, where such problems are nonexistent. If there is some sort of master plan governing spacing, I'd sure like to know what it is. Thanks, sorry to bitch.