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

Re: can I access output of locate?



13.03.2015, 20:19, "zzapper" <david@xxxxxxxxxxxxxx>:
> Edelwin Khaelos <edelwin@xxxxxxxxxx> wrote in news:55031519.9020906
> @mailoo.org:
> variables
>
> # then to answer my own question
> a=($(locate my.cnf))  # the outer () are important

Now locate something with a space. This variant works only as long as you are certain you have no characters from IFS in a file name.

Thus you should use a=( ${(0)"$(locate -0 my.cnf)"} ).

>
> echo ${a[1]}
>
> --
> zzapper
> https://twitter.com/dailyzshtip
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> http://www.avast.com



Messages sorted by: Reverse Date, Date, Thread, Author