From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13996 invoked from network); 24 Oct 2021 00:25:46 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Oct 2021 00:25:46 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1635035146; b=iMGAYNF1LKxPBwBk1X6OlwdeOdmSgBFnhlR5NZstjS2GFsVgj7loZxXF5dpzmpcRysBvPpqArm QHCKzatDykFAvMJsebqLJ7uYA0ZIcwtGAhv+sCpotNPAaTWgwZBeJ+0wIJEIAeZ21OtYWqL9Wb OX5vfFW6ZJkAgJHiy11uTOsoLb25UKTuwO2Vd143CCF+XwR+dBVaPd2//aKrVMH3m4iJGC0Wan 719Z6hmoZkmeQS29GUcmxXs6u4+P/ltwiJGA+oH6ftRGCUxAzEVDZ61nVKtH95NyKjZu8LXiIa jgOadCZFV78Nki+r9XtlTIONdaYaDjo+8JP4jTvpEEiQsg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-il1-f174.google.com) smtp.remote-ip=209.85.166.174; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1635035146; bh=XW9X+JqOKM5050rpoNXvsjbQOPnzWicAr7ZpnXjtmoc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Sn3GqAhQdlkfT81sjXhJw9Nv29fVCewnOeAiK7ctrYNYSUu0M/Bclnj8Je1iNY897HEdnGSk6z zL7znBnnVlOO0YTTKdrTBaDHV3U7QsRtOfu4NZiSc5wyy1aMVAC5E+m0OljOC0FAWyPJqIepyQ Usg4dz+25BfB1e+DlBqK7cPRlIiG1HZVgHABAyaFC6DW2OLk7Ou2TaErNndzRHkmreD8SAJMnG bSWitkkN4ygJKLGd38IQ0uCPoT4QjUMyF5LkPc1OiiOANQTDUxEMHvl6DzjXeagooeUbNb+uM/ FoFbsYB2gOAaK5mB87a/X0gHV4rk2ZDAYPpTv4yAdxskBQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=qAUBdAPM8MN6CJDQR62kV+iU2EaJvu6vi1LXh9z9KQo=; b=KtiWHBElILln1Hb1aAPM1lryCa 63Ials+Kx+tUXYmPg62aEoIMCi1yCOnuTUcfDRUsjfWUBh5yB84zZrEWJmHEXm2Uc4dJ7WzE4ny7G v6eOYbxFkeIvhvjhGlAKWhm5NZpr7xbXi5RiDPHhZ/Xmp8EhXUzItwFoQ54mvHP6dLZhU7/3rZ5dO NcmVhhJNxs14EpKVTo7FHCos+5lxFFytOkQpt00cZ2v6efym12KrWfTZHVd09zUvBSDhw/fZZX/OW 12RyRxZv3TRw4hDHAdZWYl3iYvNSTsg3e5rOY/UR5AUufNkJ7z/EHFaSUo0/6VBFRwBBnxHYVPtLV HBYaFVKA==; Received: from authenticated user by zero.zsh.org with local id 1meRKb-0001pr-Pn; Sun, 24 Oct 2021 00:25:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-il1-f174.google.com) smtp.remote-ip=209.85.166.174; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-il1-f174.google.com ([209.85.166.174]:40723) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1meRJZ-00016b-Ca; Sun, 24 Oct 2021 00:24:42 +0000 Received: by mail-il1-f174.google.com with SMTP id 3so6063864ilq.7 for ; Sat, 23 Oct 2021 17:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qAUBdAPM8MN6CJDQR62kV+iU2EaJvu6vi1LXh9z9KQo=; b=jH9mD+ubOOHiyIBumuQN1NtTsUuNLWQPYnq36qVs/FGIAOaNGKAXKVP2Hd+6Fz5T1v Ti+yk6GXBRAs7JTVP4SbLoHasN2GasGX6/aJRs4vLfyrYHkKfBtIoqQ5h41WjndIer96 kuPvuyg33E24KoARFD/nl4gfV3IliIsMlBMuzoFqLs3OnDwx6G29KIjyqdGKr3A0G9OC GnnNW0oglApRUCVSRNUrkIHdluXNyG0EQ6c8L7qzM0+MlD0xz8FRLd21h2vUgT8gAmPs Xi8PP6EZFZ4BxXuYFINQyuQcuCPp2f/gT6aW1NuLdyRxYokM0XwAGX3QZ9wnCM2r8yor y8dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qAUBdAPM8MN6CJDQR62kV+iU2EaJvu6vi1LXh9z9KQo=; b=x6dwRe8IVFygpx+Ol7NJOGPGD++opRKnIiekDj96bDsFImSrFbKZeUgptVBVk1peDb 3cAGUmyyn/8RkCGAFQBTe+b6LNso9ar9zO0YOglpSovmEo0gO879tUoEpHEnnXI01IrP 5h8bbL5tPngYa1yezfovfXDiKtWXlTLGvMiIgxY6bQrfArVeQOgQM3P42YkR7ghEUtB3 xCr//4aZA27b77v7pKTDLVpfcNj38TxcHzFoWZPzqcT23+LstgtgRK+Xu6dbCKo0NFal +v9gtHztKV94thc3I2K7zFUw+DD0iPWaik4r4m8YGbP++yiHsS/pIyHs62m3Kkb2txgV SOvA== X-Gm-Message-State: AOAM532ApHyxI9rSOqvkdorvccGeoLT//5m8tTR/GfluOLKhIWp2vjPf Z46KegTIMipHvXYVXOTZd2SiYt+13CSzdhDGDBs= X-Google-Smtp-Source: ABdhPJwQtnrVGsaZb+FmBCFdFJoZe06Dj48NrR1sTwLuD3uCWt9m0cK6EVlwkSl5BN7lp9IW2+CPi7h/6TDw3HVC8rY= X-Received: by 2002:a92:cda3:: with SMTP id g3mr4854211ild.103.1635035079941; Sat, 23 Oct 2021 17:24:39 -0700 (PDT) MIME-Version: 1.0 References: <20211023164338.GA6763@gmx.de> <095002061dc32afdfb1dcfe51e1171e23e62375d.camel@ntlworld.com> <20211023172445.GA8911@gmx.de> <0b757d10f1a2374d5a84199fbed71314e16fea63.camel@ntlworld.com> In-Reply-To: From: Pier Paolo Grassi Date: Sun, 24 Oct 2021 02:24:04 +0200 Message-ID: Subject: Re: Most Recent File To: Bart Schaefer Cc: Vin Shelton , Peter Stephenson , Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000022a38d05cf0e450a" X-Seq: 27278 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --00000000000022a38d05cf0e450a Content-Type: text/plain; charset="UTF-8" >That doesn't work because if one of the file names has a newline in >it, (f) will split it into two words. (Also I think you left out an >open paren.) sorry about that, I haven't ever considered newlines in filenames, since I wouldn't put them in the first place. Of course that's not to say that cannot happen anyway, of course. And yes, it should have been: ls "${(f)$(recent 3)}" thanks for catching that Pier Paolo Grassi Il giorno dom 24 ott 2021 alle ore 00:42 Bart Schaefer < schaefer@brasslantern.com> ha scritto: > On Sat, Oct 23, 2021 at 1:57 PM Pier Paolo Grassi > wrote: > > > > and use it like this: > > > > ls "${(f)$recent 3)}" > > That doesn't work because if one of the file names has a newline in > it, (f) will split it into two words. (Also I think you left out an > open paren.) > > print -lr -- ${(q)f} > > and then > > eval ls -ld $(recent 3) > > seems to be the closest thing. > > > Il giorno sab 23 ott 2021 alle ore 22:44 Vin Shelton < > acs@alumni.princeton.edu> ha scritto: > >> > >> What am I doing wrong? Does quoting not work correctly in captured > output? > > The trouble is that "ls" doesn't interpret the quoting, when $(...) > preserves it. So you have to emit the quotes in a form that the shell > can interpret, and then use "eval" to make that happen. > > For extra safety, you could use ${(qqqq)f} instead. > --00000000000022a38d05cf0e450a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>That doesn't work because if one of the file = names has a newline in
>it, (f) will split it into two words.=C2=A0 (= Also I think you left out an
>open paren.)

so= rry about that, I haven't ever considered=C2=A0newlines in filenames, s= ince I wouldn't put them in the first place. Of course that's not t= o say that cannot happen anyway, of course.
And yes, it should have bee= n:

ls "${(f)$(recent 3)}"
= =C2=A0
thanks for catching that

Pier Paolo= Grassi


Il giorno do= m 24 ott 2021 alle ore 00:42 Bart Schaefer <schaefer@brasslantern.com> ha scritto:
On Sat, Oct 23, 2021 at 1:57= PM Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
>
> and use it like this:
>
> ls "${(f)$recent 3)}"

That doesn't work because if one of the file names has a newline in
it, (f) will split it into two words.=C2=A0 (Also I think you left out an open paren.)

print -lr -- ${(q)f}

and then

eval ls -ld $(recent 3)

seems to be the closest thing.

> Il giorno sab 23 ott 2021 alle ore 22:44 Vin Shelton <acs@alumni.princeton.edu> ha scritto:
>>
>> What am I doing wrong?=C2=A0 Does quoting not work correctly in ca= ptured output?

The trouble is that "ls" doesn't interpret the quoting, when = $(...)
preserves it.=C2=A0 So you have to emit the quotes in a form that the shell=
can interpret, and then use "eval" to make that happen.

For extra safety, you could use ${(qqqq)f} instead.
--00000000000022a38d05cf0e450a--