Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cd $(locate zoo.txt|head -1)(:h)
- X-seq: zsh-users 21281
- From: zzapper <david@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: cd $(locate zoo.txt|head -1)(:h)
- Date: Fri, 12 Feb 2016 20:45:06 +0000 (UTC)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Your Company
- References: <XnsA5AC8D35FCD60davidrayninfocouk@80.91.229.13> <XnsA5ACBCB415Adavidrayninfocouk@80.91.229.13> <160212120144.ZM15028@torch.brasslantern.com>
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote in
news:160212120144.ZM15028@xxxxxxxxxxxxxxxxxxxxxx:
)
>
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author