Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cd $(locate zoo.txt|head -1)(:h)



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