From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id EAA22528 for ; Mon, 3 Jun 1996 04:13:28 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA04054; Sun, 2 Jun 1996 14:04:02 -0400 (EDT) Resent-Date: Sun, 2 Jun 1996 14:04:02 -0400 (EDT) From: Fung-Chai Lim Message-Id: <9606021800.AA01569@fclim.singnet.com.sg> Subject: Builtin append() and prepend() to PATH, CDPATH, etc. To: zsh-workers@math.gatech.edu (The Z-shell) Date: Mon, 3 Jun 1996 01:59:27 +0800 (SGT) X-Mailer: ELM [version 2.4 PL22] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"z6CtG1.0.D_.HUTin"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1244 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Hi, I have not check the documentation to see if this is already in zsh. I have not even compile and install the latest version; zsh is evolving too fast for me to catch up. Anyway, I am referring to the shell functions named append() and prepend() that I'd found in Sun's /usr/openwin/bin/openwin. They are used to add components to colon-separated variables like PATH, CDPATH, MANPATH, etc, and will only add the component if the component is not already in the variable. I would like to see these 2 capabilities built-in into the shell with some syntactic sugar on top. For example, zsh has `pushd_ignore_dups'. I think it would be easy to add a builtin function, say, `uniq-var' that, like `export', accept a variable list of arguments. An example is $ uniq-var PATH CDPATH MANPATH After evaluating this statement, modifying any of the 3 variables would ensure no duplication: $ set path = (/usr/local/bin $path /usr/bin) would prepend /usr/local/bin and append /usr/bin into PATH only if they are not already in it. Having such features would help with the current lengthy and redundant output with "echo $PATH". Having them builtin would speed up the evaluation of .zprofile. Thanks in advance. Regards, fclim.