zsh-users
 help / color / mirror / code / Atom feed
* Setting paths with ~'s in values.
@ 1999-02-12 20:17 Larry P . Schrof
  1999-02-12 22:05 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Larry P . Schrof @ 1999-02-12 20:17 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-02-24  5:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-12 20:17 Setting paths with ~'s in values Larry P . Schrof
1999-02-12 22:05 ` Bart Schaefer
1999-02-12 22:29   ` Bart Schaefer
1999-02-22 22:20   ` Danny Dulai
1999-02-23  4:58     ` Bart Schaefer
1999-02-23  8:39       ` Danny Dulai
1999-02-24  5:07         ` Bart Schaefer

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).