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

Re: Correct way to set environment



On Dec 15,  6:33pm, Peter Stephenson wrote:
}
} (iii) you don't want the paths to keep getting extended with repeated
} values: for this, zsh has the -U (unique) keyword.  It only works on
} colon-separated arrays if the shell knows that's what they are.

On Dec 15, 11:19am, Bart Schaefer wrote:
}
} Zsh then collapses duplicates out of the arrays and updates the "tied"
} strings to match.  Note, however, that if you assign directly to the
} string variable instead of assigning to the array, then zsh does NOT
} apply the uniqueness property, so you must remember to use the array
} assignment form after tying.

Apparently I get to learn (or re-learn) something today as well.

I've never to my recollection attempted to apply -U to the string part
of a tied pair.  So my statement above applies only when the array part
has been declared unique but the string part has not.

(Most likely this is because my .zsh* files are written to work with any
version clear back to 2.4 from the mid-90s, and -U was not originally a
property of scalar variables.)



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