From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26333 invoked by alias); 12 Oct 2015 02:37:57 -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: 20739 Received: (qmail 8645 invoked from network); 12 Oct 2015 02:37:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=957N2epDJXIRBXiwx58E/88prqE=; b=SZw08I ChSBSAY8goTf30aQ+YddS//UepdVapxd4jmeYJ3lOU/vp66ijDkrywBDDYNQLsQ3 akV//y1rvFLWAMrWo6KyRhPolvnh5XLccnS4GLfHxZOcMkVYVZnJEb3zLA+z17YB pvvolHjH9Pge73Ok09uc6EIiLr61k4veMrYSw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=957N2epDJXIRBXiwx58E/88prqE=; b=b20zB druWkuKIdBKPigouUOpar87XWDEWkn02ROG+TzP9CfdvQq3YMaITr1fL85ndttM8 pnFTyGwe5eJpil7RnhGaDskMGWVv5apEDvtwV7kLRblchQVxLM8Gk0oAQ4sJYxM7 xYYm6icZHCdIvk+Agkqq2dwRmMPIMc/caI7TmA= X-Sasl-enc: 3Lm9CbrLKTu75n86GAde1ORuLMYY7Pd785wGqZPmb/sU 1444616799 Date: Mon, 12 Oct 2015 02:26:37 +0000 From: Daniel Shahaf To: Ray Andrews Cc: Zsh Users Subject: Re: subsitutions and beginning of lines. Message-ID: <20151012022637.GB2464@tarsus.local2> References: <561AB49A.4060801@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <561AB49A.4060801@eastlink.ca> User-Agent: Mutt/1.5.21 (2010-09-15) Ray Andrews wrote on Sun, Oct 11, 2015 at 12:12:26 -0700: > ${var// /} > > When doing that sort of substitution, is is possible to test for newlines? > I'm playing with a function that grabs history and I'm trying to strip > off the leading numbers. If you're trying to parse something like this: % history | tail -2 1004 echo foo 1005 echo bar You could avoid parsing the line numbers (and unescaping the commands) altogether by accessing the history differently: % print -r - $history[1004] echo foo