From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id a52df5fa for ; Wed, 21 Aug 2019 15:18:40 +0000 (UTC) Received: (qmail 12063 invoked by alias); 21 Aug 2019 15:18:34 -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: List-Unsubscribe: X-Seq: 24171 Received: (qmail 74 invoked by uid 1010); 21 Aug 2019 15:18:33 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm1-f47.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25545. spamassassin: 3.4.2. Clear:RC:0(209.85.128.47):SA:0(-2.0/5.0):. Processed in 4.097815 secs); 21 Aug 2019 15:18:33 -0000 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.47 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9Ig1K0Tuf09gObXg3xIMyWVcaonbGGofJgi/aR9XLJc=; b=ax/6NrbUNzmquL9itq1E4l0CbpKPVKZ0SKhSVd9lr5s79mhJRDWSH630nPXiYfoK6v GI3aKTe+jvYlhulPAzcjxfhosH5VlP8hWgh8pFDT25MHSav3BB1VI954QJRa0Oja9LPi 7Ys+YgeRwCVi2EwS0oXuPJ35IHA+2vy2TIsIeG0+itdCLqpV2vKRB89W3YmcTkjNd+py Z4YslWONBNZrMOLaAy+Fs17p1KcCOC2lomhmJBOtHB3nZ2G/4KkF6aexKLCZ1u3MPGQx VqRrE30twp/m1SIvECk2/cW2fdNZXijw1FefYN2Qfn4qbvvyHjJfD/58CAeXxPTyDlXx rmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=9Ig1K0Tuf09gObXg3xIMyWVcaonbGGofJgi/aR9XLJc=; b=TCaOIoFMGNrDIepcLdPP/eWtas++ChVAHXoq77DeYiT6kpoXbjES7blazhPYzUAaai JU3SryhksbhkfzSFeWQB62ayeRK+lEdKj+SXEK8DsC6oH0zy3LmV+6HdNNjdEIigdrsq ZfpxbQvUcxN1Ib5R5UR1ZI7PQLhZvMRHEHefXbXPB0wGtxUeNx9RIonFYx6jCnOQNlz6 nuOaomRRgbw0Cm1q3QR9Iy50F0WhM+rHtu6XhZbbeI7ovrGOHozDF/g8vX0r47qQqvXF mEvQXU3Yi62Ei2syhgztFwQpZe1FvgAbaDkbiAWst/VurTJK/SBoYnpZ27qZSsgaRwH1 QogQ== X-Gm-Message-State: APjAAAWcbsHy/onsdsnookinDjbpcX0WKH6+5oZSQQyIIzFn0/xbzPPL 2SklLK5Pl4z7Pj3k1BBMv5Q= X-Google-Smtp-Source: APXvYqzQyy6qXaV0M9dPr/jz11iuPHUF5QyE/v+ZygmHijatdaQDrhMZqrz3e/9uuvCqpknQCW4S9Q== X-Received: by 2002:a7b:c857:: with SMTP id c23mr637067wml.51.1566400674678; Wed, 21 Aug 2019 08:17:54 -0700 (PDT) Date: Wed, 21 Aug 2019 16:17:52 +0100 From: Stephane Chazelas To: Aryn Starr Cc: zsh-users@zsh.org Subject: Re: Get the result of the last glob Message-ID: <20190821151752.ftwx7demdwsnxjtu@chaz.gmail.com> Mail-Followup-To: Aryn Starr , zsh-users@zsh.org References: <918ED85F-9DE5-4365-B962-45AD4AADDF46__5329.09398186661$1566393766$gmane$org@icloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <918ED85F-9DE5-4365-B962-45AD4AADDF46__5329.09398186661$1566393766$gmane$org@icloud.com> User-Agent: NeoMutt/20171215 2019-08-21 17:51:11 +0430, Aryn Starr: > Is there a way to get the result of the last glob? > I want to do sth like this in a folder with only one file, somebook.mobi: > > ebook-convert * *.epub > > Which I want expanded to: > > ebook-convert somebook.mobi somebook.mobi.epub [...] You could use zargs for that: autoload -Uz zargs # in ~/.zshrc zargs -I@ ./* -- ebook-convert @ @.epub Though I generally find that using a loop is generally quicker, shorter and safer (and you have more control over what's going on): (for f (./*) ebook-convert $f $f.epub) (using a subshell to get a more deterministic behaviour upon ^C/^Z). Here, assuming that "ebook-convert" supports the -- end-of-option delimiter (if it doesn't replace -p with -P and * with ./*), you could also do: autoload -Uz zmv # in ~/.zshrc zmv -p ebook-convert '*' '$f.epub' Or alias wzmv='noglob zmv -W' # in ~/.zshrc wzmv -p ebook-convert * *.epub zmv does some sanity checks which you could find useful here, like that none of the destination files exist before starting the moves. -- Stephant