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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32702 invoked from network); 23 Oct 2021 16:59:15 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Oct 2021 16:59:15 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1635008355; b=DTAPInaxEvF06hqtyCmaeSvh2aoRn4Ms4qvH8W91yaTx4aQBWco7302Cx+iSCFZtoJhWBY1FzT B6fBKzlVzc3GPLgOm7mPfcA63+LhM6giqgz/B045jNthP2EDOKutiBh6WJ5rTgni1RM+7yHYPY iaYx7lbTUCLsr5QYYJQ5Xk99xfv7vwzTaEg/Fz7TLOxkJCEPpwPaOkec+3kG5+5o9fsl67DovF NLJfJqwuk2O88rrMxNsqquJ+t6atq9XFJxveck9H9vFS9gXhx6/oHWzO7HtVd3f4VmL39nZtmA QiMkKuAMLbJSXcJs0lcVdXS4hFaxImx6SRmo52I/9Vj3Uw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1635008355; bh=JDs/QRV+u489WuIYtQy/JuHBJUwyUQYQDEasH5Oiq6g=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature: DKIM-Signature; b=rmen+ynfKuHecd6HWI1MIHSc1/a9slLuxFOUOcqiVxFPRv5L3u9nI/JUgsEcyo59ojxCOoxXVu T/ZdmEI6/ZORpudzt1gehDOx6snL/AY3hsaV0YucMGwCDJzZmWNSU+Ku3LILFg/M1SKE6RWBOg +nf0x9lpKrx3rpsu2mewk1NfmvSHcXGGXvUbko4atJ8b50RUM+OP6Fk0NgQvMJq7ekw74ywuwA Ujf2rTUXEgiZ7AM2hjLDFdj7mbGjQnH46X3oNZvXWNn0bA8+9HlkMDoIKeiOEUGH0twZI+0gOe tuyWZ+5yMCRWKAr2bnfYCONFD0jWQSCBezzDPJJiZGCbrg==; 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-Transfer-Encoding: Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=AqokAzO6/DEBLAZvEOsqGju4UzTxjkYlMDU+nAc3N0M=; b=GWgj9tpObdf1PhejkPjG5+2wd1 iLW5ENamyHX4D/eGMXXOQLfDX8Oy3FJ/t9GHyy5GqcWdkXcr4uWsMk6QoILIdmJJLDr9vcSCT6iw8 1VdrZEDJaReUz/i5+q1yT3HAVzGs5lwQw8wFe2EBPXc0k/3fROqJdlXUREcnaXRdGBnQgOCvOBbYd 5uvLpTOHyY7ORDcR5qKN2WTP+mJzjNC+sasvmFzQ+ps8MrXIiQtjv8XbcLca3iweraKZW8e0ZNqzn StuRJxRRnGtXk7rAZBzOWJ4QZriTRYpha5mkzyKpoqF3886lCjsoCFGKep9MjwemG2qrzMIUt6kZJ eNdLIvaw==; Received: from authenticated user by zero.zsh.org with local id 1meKMV-0000EM-Ef; Sat, 23 Oct 2021 16:59:15 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from smtpq1.tb.ukmail.iss.as9143.net ([212.54.57.96]:50780) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1meKLl-000PUh-G5; Sat, 23 Oct 2021 16:58:29 +0000 Received: from [212.54.57.111] (helo=csmtp7.tb.ukmail.iss.as9143.net) by smtpq1.tb.ukmail.iss.as9143.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meKLl-0006q7-7F for zsh-users@zsh.org; Sat, 23 Oct 2021 18:58:29 +0200 Received: from pws-Zeus ([82.1.229.179]) by cmsmtp with ESMTPA id eKLkmSfplufb4eKLkmWHr5; Sat, 23 Oct 2021 18:58:28 +0200 X-Originating-IP: [82.1.229.179] X-Authenticated-Sender: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.4 cv=FOAIesks c=1 sm=1 tr=0 ts=61743f34 cx=a_exe a=W4rGJ7PGCSRRUvufKHO8Dg==:117 a=W4rGJ7PGCSRRUvufKHO8Dg==:17 a=IkcTkHD0fZMA:10 a=8gfv0ekSlNoA:10 a=rc5zGvF7F0wiPAXw6xcA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1635008308; bh=AqokAzO6/DEBLAZvEOsqGju4UzTxjkYlMDU+nAc3N0M=; h=Subject:From:To:Date:In-Reply-To:References; b=1t5dyN5vgPMv2MQTW3c67xPHgNtGKNKAuhEaayi9oUnYwViOaHXhnArSu44NlVXgx Iv92UjzJ+/R57aw8SFfnel3L30hYEXqal3PSFWKpfLFwf8qinevxKUgXREI8Jr7/TH 8BsSprGSvTmEwZx+LGYNvYq+RxT5lWBcWqOhRjm9778ClO+7Z8i9mkFixR8tZuhyJa j5YY3608/5Fusbofdl+C2rVdzis43bqHCaNRewOaQiUt9KSbSw0GdKiQ3MxQgTurQa iglIjHQb2h8CjwNXx7TWM8l+J3e/LC3a2e9IElAz/klDTES0eYjz8+y/7hUmiNsQ66 AqEUL2yyZ9n0A== Message-ID: <095002061dc32afdfb1dcfe51e1171e23e62375d.camel@ntlworld.com> Subject: Re: Most Recent File From: Peter Stephenson To: zsh-users@zsh.org Date: Sat, 23 Oct 2021 17:58:28 +0100 In-Reply-To: <20211023164338.GA6763@gmx.de> References: <20211023164338.GA6763@gmx.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfCxrX3VFRW06wZMF+vu5djqFnQoT8t+B1zdU1sPV7/SYMEMkr/iaEUcTyl7fWNomjXB2+zDQ1wyQNTuYIa6sT/467b2Mkzls2J5s/iquotDBzwFgruHT vcXTkG2cpiKpTdRh7DRh+a5so3pOPGUqX854f7tG0+FbbDa6QjBs9U73Rarfu2JtnyrQp+bvIjgqYw== X-Seq: 27269 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: On Sat, 2021-10-23 at 17:43 +0100, Dominik Vogt wrote: > On Sat, Oct 23, 2021 at 12:15:35PM -0400, Vin Shelton wrote: > > I want to list the most recent file in the current directory. > > print -l -- *(-om[1,1]) > > works for ordinary filenames, but does not quote the output appropriately > > if the filename contains spaces. How do I quote the expression to > > accommodate filenames which contain spaces? > > # Put in variable, quote variable as needed > $ F="$(echo *(-om[1,1]))" > $ print -- ${(q)F} An array would be neater since you get globbing for free... it also extends more naturally if you need multiple files (print -l then handles those on multiple lines, though there are other ways there). f=(*(-om[1,1])) print -l -- ${(q)f} You get the choice of type of quoting here by changing the (q) to its various relatives. pws