From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20028 invoked from network); 27 Apr 1999 21:24:08 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Apr 1999 21:24:08 -0000 Received: (qmail 20825 invoked by alias); 27 Apr 1999 21:23:12 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2314 Received: (qmail 20818 invoked from network); 27 Apr 1999 21:23:11 -0000 Date: Tue, 27 Apr 1999 17:22:59 -0400 From: Sweth Chandramouli To: ZSH Users Subject: path vs. PATH, and other issues Message-ID: <19990427172259.A15774@astaroth.nit.gwu.edu> Mail-Followup-To: ZSH Users Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i ok. so i have a function that has been working fine on my desktop machine, running zsh 3.1.5, for a while now, as follows: #!/usr/local/bin/zsh -f addpath () { local PATHVAR=$1 ; shift eval local TEMP_ARRAY=\$${PATHVAR} TEMP_ARRAY=(${TEMP_ARRAY:gs/:/ /}) local ARRAY_TO_ADD=${(j< >)@} ARRAY_TO_ADD=${ARRAY_TO_ADD:gs/:/ /} for DIR_TO_ADD in ${=ARRAY_TO_ADD} ; do if [[ -d ${DIR_TO_ADD} ]] ; then if [[ -n ${TEMP_ARRAY} ]] ; then TEMP_ARRAY=(${=TEMP_ARRAY} ${DIR_TO_ADD}) else TEMP_ARRAY=(${DIR_TO_ADD}) fi; fi; done; typeset -U TEMP_ARRAY echo "TEMP ARRAY: $TEMP_ARRAY" echo $PATH eval "export ${PATHVAR}=${(j<:>)TEMP_ARRAY}" }; this function, once loaded, lets me do things in my init files like addpath PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin addpath PATH /usr/ccs/bin /usr/ucb /usr/proc/bin addpath PATH /usr/dt/bin:/usr/openwin/bin:/usr/lib/lp/postscript # addpath PATH /opt/netscape:/opt/samba/bin:/opt/SUNWwabi/bin:/opt/hpnp/bin addpath PATH /home/sweth/bin:/home/sweth/working:. addpath MANPATH /usr/man /usr/share/man /usr/local/man:/usr/X/man addpath MANPATH /usr/dt/man:/opt/hpnp/man:/opt/samba/man addpath LD_LIBRARY_PATH /usr/lib:/usr/local/lib:/usr/ucblib/:/usr/X/lib addpath LD_LIBRARY_PATH /usr/openwin/lib:/usr/dt/lib and end up with the PATH-like variables I am referencing being set to strings of colon-separated unique names of directories that exist on the local system. i recently exported my home directories from this machine to another machine running the same os and same zsh version. when i log in to that machine, the line above that i have commented out (for /opt/netscape, etc.) produces an error of /home/sweth/.zsh/initialize: not an identifier: /sbin where /home/sweth/.zsh/initialize is the script that is running the above commands. after this happens, $PATH is set to /bin:/home/sweth/bin:/home/sweth/working:. and $path is completely unset. commenting the offending line out makes everything work fine. the only thing distinctive that i can think of about that line is that, on the machine to which i've just started logging in, none of the listed directories exist; that, however, was why i made this function in the first place--to not add non-existant directories to my path but be able to keep one generic config file. two questions: one, why is addpath failing on that line; and two, how can $path be unset if $PATH is set? (and a third: it appears that $path is the parameter that is actually used for finding executables, since after this error i have to specify all paths explicitly. is this the case?) -- sweth. -- Sweth Chandramouli IS Coordinator, The George Washington University / (202) 994 - 8521 (V) / (202) 994 - 0458 (F) *