From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7142 invoked by alias); 7 Jun 2016 18:47:35 -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: 21625 Received: (qmail 27803 invoked from network); 7 Jun 2016 18:47:34 -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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=BYGNLMT/tqbFfzETCFdeUkI+FTiAratCW0K2Ie1ovf0=; b=cquBVfTQMlvwwtzM3QUYg5G071eOG2WG43qsYVTboxWrKiQKiBEH7++LAt7EZlOz6x c/TaRPYD/S5cbjpEB8jNodhWJ8R1thD2I3vDswd14b3IriIhtBEKvT7nxITJsgkl0YwQ PtWwLff+pBrcyYhFX/lougrzSHuffPD55GJxktBuF6fiHu2gPqdeXP5lVANuakXFCdE6 QYCYdhSBRl29Q6Ub49++VhO/auSyONcNZJUUp8I7wT9CtIEVEQm1UxX5Y8FutiDAy+Yd a5cZiNFffEcXlgo0GXJ+OMzN5N9Twf+WgF19Q9q71YJAOFmJsHq+wALPi2TcouLBOeLP 8WLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=BYGNLMT/tqbFfzETCFdeUkI+FTiAratCW0K2Ie1ovf0=; b=Y0yyuRplxVt9Elj5WUkqS1czYSp+Xwmnis1tmznW5+IrCMn/rWFM6AYunJ5OF3tZpE Y5XIAhSDBFgfEe7y0u01dhRVIPlzkUx2JdMkrZTaHCOIkVOwKNaJ4eNGdfic3Umixw3e nYaIo6E5IlkzkDDUqk4au1ueAwVf4iH1Ls2FDVlGvUju8PeRp0Ymq9ItFnm/uB2mUwrs PhquEBs9bd/R2OehBBEhFx+HCj2jIGWyHvG1pjNcNEQV4LUwMoYuhKm1ImMUmxqbJ+Jo q/fq4rW6LFdt4npRi6roWQYcBm3P1ViAL5/HfYYgwglnVx7vz0AYsYom5OymFfpkO7ac Qk7A== X-Gm-Message-State: ALyK8tIO3I3fb+qH0TK5sz5LL646ZwrCIXtf7lwJ8g4oPtvvsn+SWW/ATUTN6wglq4he/LpabHNVAvY0FGxWXA== X-Received: by 10.25.42.4 with SMTP id q4mr3726918lfq.102.1465325249140; Tue, 07 Jun 2016 11:47:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <26949.1465300483@thecus.kiddle.eu> References: <26949.1465300483@thecus.kiddle.eu> From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= Date: Tue, 7 Jun 2016 20:47:28 +0200 Message-ID: Subject: Re: A minor syntax question To: Zsh Users Content-Type: multipart/alternative; boundary=001a113fff1cf49b700534b49edd --001a113fff1cf49b700534b49edd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Both your examples work great, Oliver. Thank you. Inspired by your second example I also found a solution which more closely follows the way I have been thinking about the problem, and that I find quite readable: typearg=3D"("${(j: -o :)${types:#-t}/#/-type }")" On Tue, Jun 7, 2016 at 1:54 PM, Oliver Kiddle wrote: > Jesper Nyg=C3=A5rds wrote: > > typearg=3D"("${"$(print -- '-o -type '${^types:#-t})"#-o }")" > > > away the leading '-o'. It works as intended, but I feel it is more > > complicated than required. In particular, I couldn't find a way to make > the > > '${^...}' parameter expansion trigger without the embedded print > statement. > > Joining the array to form a string should avoid the need for a print, > allowing the #-o to apply to the string as a whole. E.g: > > typearg=3D${${(j. .):-'-o -type '${^types:#-t}}#-o } > > Shorter versions should be possible such as the following: > > typearg=3D"${${=3Dtypes//-t/-o -type}[2,-1]}" > > I'd be inclined to keep typearg as an array, however. > > Oliver > --001a113fff1cf49b700534b49edd--