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

Re: Literal `~` directory created?



On 2023-05-18 at 13:50 -0400, Tom Vaughan wrote:
> Thanks, Phil. Based on this it seems like the problem is due to:
> 
>     mkdir -m 0700 -p "$_cache_dir"

> Tilde is not expanded when quoted, right? _cache_dir is set a little higher up at https://github.com/zsh-users/zsh/blob/master/Completion/Base/Utility/_store_cache#L10:
> 
>     $ echo $_cache_dir
> 
>     $ zstyle -s ":completion:${curcontext}:" cache-path _cache_dir
> 
>     $ echo $_cache_dir
>     ~/.cache/zsh/compcache
> 
> Perhaps this tilde should be expanded? Running the mkdir command above creates a literal '~' directory in the current working directory.

It should have been expanded _when you set the style_.

So don't quote a parameter when invoking zstyle to set it, because then
you're setting the style's value to hold the literal string.

You should have things like:

    zstyle ':completion:*' urls ~/.urls
    zstyle ':completion:*' cache-path ~/.cache/zsh/${HOST%%.*}

-Phil




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