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

Re: alias with a parameter



On 4/10/21 10:30 AM, Grant Taylor wrote:
Why use "$+1"?  I would have thought to use "$#" instead.

I found the answer to my own question.

man zshexpn

   ${+name}
If name is the name of a set parameter `1' is substituted, otherwise `0' is substituted.

This also avoids ticking the number of parameters bug introduced by $#.

I always end up learning something from or as a direct result of reading messages from this list. :-)



--
Grant. . . .
unix || die

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



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