From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: ZSH Users <zsh-users@sunsite.auc.dk>
Subject: path vs. PATH, and other issues
Date: Tue, 27 Apr 1999 17:22:59 -0400 [thread overview]
Message-ID: <19990427172259.A15774@astaroth.nit.gwu.edu> (raw)
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
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>
reply other threads:[~1999-04-27 21:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19990427172259.A15774@astaroth.nit.gwu.edu \
--to=sweth@astaroth.nit.gwu.edu \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).