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

Re: 'whence' question



Got that patch.  It works as advertised but I noticed this:

   $ whence -vam "zsh*"                       << QUOTED
   zsh is an alias for /usr/local/bin/zsh
   zshh is an alias for /usr/local/bin/zsh    << CATCHES ALIAS
   zsh-RayStyle1 is a shell function       << CATCHES FUNCTION
   zshh is a shell function                      << CATCHES FUNCTION
   zshh is /usr/local/bin/zshh                    << CATCHES SCRIPT
   zsh is /usr/local/bin/zsh
   zsh-RayStyle1 is /usr/local/bin/zsh-RayStyle1    << CATCHES BINARY
   zsh is /usr/bin/zsh
   zsh is /bin/zsh

   $ whence -vam zsh*                        << UNQUOTED
   zsh is an alias for /usr/local/bin/zsh
   ?  zshh  ...                                        << MISSES ALIAS
   ?   zshh ...                                        << MISSES FUNCTION
   ?   zshh ...                                         << MISSES SCRIPT
   zsh is /usr/local/bin/zsh
   zsh is /usr/bin/zsh
   zsh is /bin/zsh
   zsh-RayStyle1 is a shell function                        << CATCHES
   FUNCTION
   zsh-RayStyle1 is /usr/local/bin/zsh-RayStyle1        << CATCHES BINARY

I know that '-m' arguments are supposta be quoted, but, apart from the above, I haven't found any situation where it seems to make any difference. Why would it miss 'zshh' but find 'zsh-RayStyle1', and why do the quotation marks change
the order?

binary 'zsh-RayStyle1' might be found in both cases because it's linked:

lrwxrwxrwx 1 28 2014-11-10//13:39:57 zsh -> /usr/local/bin/zsh-RayStyle1*

... but it still seems strange. And the situation with the aliases and functions is hard to understand. Both functions just echo their own name, so it's not the
contents.  For now the moral of the story is to always quote, but why would
one ever *not* quote? I mean is there some valid use of it unquoted, or is that
just always wrong?  If always wrong, they can we 'autoquote' some how?
Complicated! And there's always another gotcha.

The above is not rigorous, but any clarification is welcome.




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