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

Re: zsh 3.0.1 bug



Faraut Jean-Louis wrote:
:I know of a workaround for this bug, but I would not like to edit everybody's 
:.zshenv (700 persons) :-(

What you'd like is a global function directory which everyone can autoload
functions from.  And autoload it from /etc/zshenv  so people can use it in
their .zshenv files.  How do they currently access it?  Do they all have 
their own copies of it?

: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.)

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 ...

#!/usr/bin/zsh
#zsh function to delete some dir to PATHS variables
#Author: jlf@xxxxxxx 
#	 Ecole Sup'erieure en Sciences Informatiques
#	 Sophia-Antipolis France
#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

#scan dirs
TMPPATH=""
TMPARRAY=$(eval echo '$'${2})
TMPARRAY=( ${(s/:/)=TMPARRAY} )
for i in $TMPARRAY
do
	[ "$i" != $1 ] && TMPPATH=${TMPPATH}:$i
done

#remove leading colon
TMPPATH=${TMPPATH#:}

#return result
eval ${2}=${TMPPATH}
return 0

-- 
Geoff Wing [gwing@xxxxxxxxxxxxxxx]     PrimeNet - Internet Consultancy
  Web   : http://www.primenet.com.au/  Phone    : +61-3-9818 2977
  Mobile: 0412 162 441		       Facsimile: +61-3-9819 3788



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