Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
typeset -U broken in 3.1.2?
- X-seq: zsh-users 1190
- From: Bernd Eggink <eggink@xxxxxxxxxxxxxxxxxx>
- To: zsh-users mailing list <zsh-users@xxxxxxxxxxxxxxx>
- Subject: typeset -U broken in 3.1.2?
- Date: Mon, 08 Dec 1997 15:55:14 +0100
- Organization: RRZ Uni Hamburg
- Sender: rz2a022@xxxxxxxxxxxxxxxxxx
With respect to 'typeset -U', the manual says: "For arrays keep only the
first element of each duplications".
This would be nice if you could define arrays with 'typedef', but you
can't, because in contrast to 'set', 'typeset' has no '-A' option (BTW,
why not??) and doesn't treat brace expressions specially.
After some experimenting I found that
1. outside a function, 'typeset -U x' works _only_ if 'x' has already
been defined as an array;
2. inside a function, 'typeset -U x' doesn't work at all.
Look at this script:
function f
{
typeset a # 1
a=(x y x y)
print "f: a=$a"
typeset -U a # 2
print "f: a=$a"
}
unset a
f
print "t: a=$a"
It prints:
f: a=x y x y
f: a=
t: a=x y x y
Instead of sorting the array and discarding the duplications, the second
typeset _destroys_ the value of 'a'. And the last output line reveals
that 'a' is not local to the function, as it should be.
Any comments (or, preferably, patches)?
Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@xxxxxxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author