From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id SAA07384 for ; Tue, 29 Oct 1996 18:43:31 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id CAA29848; Tue, 29 Oct 1996 02:42:44 -0500 (EST) Resent-Date: Tue, 29 Oct 1996 02:42:44 -0500 (EST) From: Zoltan Hidvegi Message-Id: <199610290201.DAA01977@hzoli.ppp.cs.elte.hu> Subject: Re: zsh 3.0.1 bug To: gwing@primenet.com.au (Geoff Wing) Date: Tue, 29 Oct 1996 03:01:27 +0100 (MET) Cc: jlf@essi.fr, zsh-workers@math.gatech.edu In-Reply-To: <199610282325.KAA05469@coral.primenet.com.au> from Geoff Wing at "Oct 29, 96 10:25:16 am" X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"deePd2.0.FI7.qLRTo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2292 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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}\""