From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: gwing@primenet.com.au (Geoff Wing)
Cc: jlf@essi.fr, zsh-workers@math.gatech.edu
Subject: Re: zsh 3.0.1 bug
Date: Tue, 29 Oct 1996 03:01:27 +0100 (MET) [thread overview]
Message-ID: <199610290201.DAA01977@hzoli.ppp.cs.elte.hu> (raw)
In-Reply-To: <199610282325.KAA05469@coral.primenet.com.au> from Geoff Wing at "Oct 29, 96 10:25:16 am"
Geoff Wing wrote:
> :If this is a zsh bug, it would be nice to get a fix...
>
> (This was introduced in 3.0.1-test2 (between Sept 3 & 23). I suspect it's
> to do with Zoltan's changes to lex.c, but then, what do I know :-)
> We'll let Zoltan clarify this.)
The lexer has to decide wether a word containing an equals sign is a
command or an assignment. For example 1foo=bar is not an assignment
because 1foo is not a valid identifier. Same holds for ${1}=foo because
`${1}' is not an identifier. It may be after expanding ${1} but the lexer
could not expand variables. That happens later.
> Here's a quick cleanup I did. There are a couple of other ways to do it and
> I suspect there are a couple of unnecessary things in there, but ...
Here is my cleanup :-) which demonstrates the power of `parameter
expansion'. If you use setopt localoptions globsubst it can also be used
as undepend pattern PATH_VARIABLE to delete everything matching pattern.
Zoltan
#!/usr/bin/zsh
#zsh function to delete some dir to PATHS variables
#Usage: undepend /some/dir PATH_VARIABLE
#Example: undepend /usr/openwin/bin PATH
# delete any occurrences of /usr/openwin/bin in $PATH
#
#Check usage
if [ $# -ne 2 ]
then
echo 'Usage: undepend /some/dir PATH_VARIABLE' 2>&1
return 1
fi
setopt local_options no_glob_subst
eval "$2=\"\${(j[:])\${(s[:])$2}:#$1}\""
prev parent reply other threads:[~1996-10-29 7:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-28 16:30 Faraut Jean-Louis
1996-10-28 23:25 ` Geoff Wing
1996-10-29 2:01 ` Zoltan Hidvegi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199610290201.DAA01977@hzoli.ppp.cs.elte.hu \
--to=hzoli@cs.elte.hu \
--cc=gwing@primenet.com.au \
--cc=jlf@essi.fr \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).