zsh-users
 help / color / mirror / code / Atom feed
From: "Larry P . Schrof" <schrof@cig.mot.com>
To: zsh-users@sunsite.auc.dk
Subject: Setting paths with ~'s in values.
Date: Fri, 12 Feb 1999 14:17:14 -0600	[thread overview]
Message-ID: <199902122018.PAA29284@po_box.cig.mot.com> (raw)

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


             reply	other threads:[~1999-02-12 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-12 20:17 Larry P . Schrof [this message]
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

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=199902122018.PAA29284@po_box.cig.mot.com \
    --to=schrof@cig.mot.com \
    --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).