Zsh Mailing List Archive
Messages sorted by:
Re: Aliasing assignment-ish words (aliases[x=y]=z)
- X-seq: zsh-workers 37545
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Aliasing assignment-ish words (aliases[x=y]=z)
- Date: Sun, 10 Jan 2016 11:19:43 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=C8G0RyqdSHkSVJvPhQhWM9k2ZCXrFpQaB0CIfGiAKkk=; b=MzSpVUhFlQRKGBKGT/OGyjUJ0wq77dfOIpTp70DrsYCqU6a3z4IEP6tiph7Mfe2b4N rZCMcRTAZtnwBa5fvWhw8CE7uNCc5PPaG/JXbGNVKUP0owpQFAF5c9eiN/KRq4vjXJSN iKWosRsyaJSgIppf5q7jAqe5qtfFkk1gCx47Pmlb6H2dNzJMr6x444nyAlpKdJoH4C2m NLX7xwD7pMsVfjEq5dPWuSOx9OohbQR6KiuT79wkN1E/SAKWVmlPNTsYftJcE7NDzP+4 QMTf6BrMjqa+uyqsUM9sFFhU4dyzx8jn/TiX2kmngVdq0IObQdPl7Eqd3zP4dWnvf301 hhQg==
- In-reply-to: <20160110003757.GA18461@tarsus.local2>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160110003757.GA18461@tarsus.local2>
On Jan 1, 12:37am, Daniel Shahaf wrote:
} Subject: Aliasing assignment-ish words (aliases[x=y]=z)
} 2 % aliases[x=y]=z
} 9 % x=y
} Shouldn't line 9 have interpreted the word 'x=y' as an alias?
No; alias expansion operates on shell words, and in that position
on the command line "x" "=" and "y" are separate words because of
assignment syntax rules. The new treatment of "typeset" as keyword
extends this to global aliases and "typeset x=y".
There's more to it than this because "=" and "y" are not subject to
global alias expansion when they appear in "x=y" but that's the basic
} Or perhaps line 2 should have signaled an error.
It's long-standing practice that you can create alias table entries for
things that it's not actually possible to later interpret as aliases.
This is especially true when assigning to the parameter as you did.
Basically in this case the rule is that if you break it you get to keep
} Also, the 'alias -L' output for that alias won't work as the code
} producing the output intended.
There is no correct output possible in this instance, the alias command
provides no way to escape the equal sign. I don't see any reasonable
alternative except to add a csh-style alias command where the word and
its expansion can be separate arguments.
That still doesn't help with the assignment-syntax conflict.
Messages sorted by: