From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19625 invoked by alias); 12 Feb 2016 20:45: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: 21281 Received: (qmail 6788 invoked from network); 12 Feb 2016 20:45:26 -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=0.8 required=5.0 tests=BAYES_00,FSL_HELO_BARE_IP_2, RCVD_NUMERIC_HELO,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.1 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: zzapper Subject: Re: cd $(locate zoo.txt|head -1)(:h) Date: Fri, 12 Feb 2016 20:45:06 +0000 (UTC) Organization: Your Company Message-ID: References: <160212120144.ZM15028@torch.brasslantern.com> X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 95.146.95.168 User-Agent: Xnews/2009.05.01 X-Antivirus: avast! (VPS 160212-0, 12/02/2016), Outbound message X-Antivirus-Status: Clean Bart Schaefer wrote in news:160212120144.ZM15028@torch.brasslantern.com: ) > > Are you answering yourself or changing the question? A bit of both! > > (By the way, that doesn't work for me; on my system the -r option has > to be immediately followed by the regular expression, so this searches > for files whose names contain "-l1".) > . > Yes it was naughty/wrong to add the -l1 in between the -r and the expression (hadn't noticed). Indeed suddenly what I want to do (see below) works cd ${$(locate -r "/zoo.txt$")[1]:h} or the simpler cd ${$(locate zoo.txt)[1]:h} echo $(locate -c -r "/zoo.txt$") matches I've been round the mulberry bush to get this far thanks! -- zzapper https://twitter.com/dailyzshtip --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus