From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19756 invoked by alias); 13 Oct 2015 19:58:28 -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: 20750 Received: (qmail 5955 invoked from network); 13 Oct 2015 19:58:26 -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 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=gMt+pPZvAMU7G8kWOp5nGvh6hkoRnNofW9hIqxz73+4=; b=i5cV0qFt4LqS1cGJm3Kbzegb5OHsiUnCMiqhxf8bFs7fG1hCOdrKw0nIu3oBf4BDcO KJ2TIaS2/8xpOXO8RhiuvnOEydoXM7t9NjMF6SezqNCfc/6gBgEBpALtWavbDblW/wQ6 ZL3nb0sPYdhgFNlBxXaE9EVFKAIh4WjKH8XTvQSUnH53NmkGuAufbOZYj2FKNp1H5NOx 7Lznh67ocm/cVqjR84FWjPAARho2/wpkl7MaZrtfHto/GjDpOBuOtctEXGna97G2Cau+ Z3YZLQ8/6QRYiQuMwXEGRBX0rwv26t+bUsmk53FSn7LkDOfUHAaC0k6D5q5mgs8IbF+E WQ1A== X-Gm-Message-State: ALoCoQm6qyV41OTBxfwp9jf3HYZNxmIdbdxb0qrlLTjkb855VykAPwlVUb6u04plx3lF+3aMBrqL X-Received: by 10.202.63.212 with SMTP id m203mr19712881oia.15.1444766302598; Tue, 13 Oct 2015 12:58:22 -0700 (PDT) From: Bart Schaefer Message-Id: <151013125819.ZM30782@torch.brasslantern.com> Date: Tue, 13 Oct 2015 12:58:19 -0700 In-Reply-To: <561C95A9.7020508@eastlink.ca> Comments: In reply to Ray Andrews "Re: subsitutions and beginning of lines." (Oct 12, 10:24pm) References: <561AB49A.4060801@eastlink.ca> <20151011210902.566de251@ntlworld.com> <561AEB2F.8030808@eastlink.ca> <20151012103455.5f6159d7@pwslap01u.europe.root.pri> <561BD55C.3080006@eastlink.ca> <561BE8DC.7060506@eastlink.ca> <151012192908.ZM15508@torch.brasslantern.com> <561C717A.1030202@eastlink.ca> <151012220313.ZM16595@torch.brasslantern.com> <561C95A9.7020508@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: subsitutions and beginning of lines. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 12, 10:24pm, Ray Andrews wrote: } } and I think my question is still a useful exercise: how would we do that } if there was no easy way? Combining the words results in a 'command not } found' error, since it seems to want to believe that 'history -10 | } ....' is one command Aren't those two unrelated issues? The "eval" you used is already the correct way to turn a string formulated as a command line into an actual command. The array manipulation you asked about would only apply to the output of the command after eval. } so I hafta leave the words unmagically joined yet the normal thing } seems to be to strip spaces down to a single one when making an array You may need to go back to a specific example, I fear. Making an array how? By capturing the output of a command? The normal thing when capturing $(...) in an array context is to treat all adjacent (consecutive) whitespace (characters listed in $IFS) as a single word break, yes. But the spaces aren't being "stripped down to a single one". They're being stripped out ENTIRELY, leaving nothing. It's when putting the array back together into a string again that a single space is inserted between words. } It doesn't help that all this splitting is invisible. This is part and parcel of the whole quoting behavior. Using double quotes when you don't want splitting is something you need to habituate. Once the quotes are in place, you can make splitting explicit/visible. Peter already gave you the ${(f)"${var}"} and ${${(f)"${var}"}##<->:} incantations; you can use this directly with $(...) as well: ${${(f)"$(eval history $nnumber $sstring)"}##<->:}