Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Setting paths with ~'s in values.
- X-seq: zsh-users 2137
- From: "Larry P . Schrof" <schrof@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Setting paths with ~'s in values.
- Date: Fri, 12 Feb 1999 14:17:14 -0600
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
I have many different machine that I have accouts on, so I conditionally
set my path with the following in my .zshenv ...
---
# Generate a nice-looking path, including only directories that exist.
for t_path in "${(f)$(<${HOME}/.zpaths)}"
do
if
[[ -d $t_path ]]
then
PATH=${PATH}:${~t_path}
fi
done
PATH=${PATH[2,-1]} # Nuke the leading ':'
---
.zpaths is a file that contains one directory per line.
It starts with the following entries:
~/bin
~/loc/bin
~/loc/X11R6/bin
...
>From the man page, I was under the impression that putting the ~
before the variable would expand the '~' in each of those paths.
Apparently, it does not. I could probably make a variable substituion
from '~' to ${HOME}, but it seems like there should be a more elegant way
to do it. Obiously, I don't want to explicitly enter the full path of
${HOME} in .zpaths.
Suggestions?
Thanks
- Larry
Messages sorted by:
Reverse Date,
Date,
Thread,
Author