From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-users@math.gatech.edu
Subject: Determining whether a user name is valid
Date: Wed, 24 Jul 1996 23:44:11 -0700 [thread overview]
Message-ID: <960724234411.ZM12007@candle.brasslantern.com> (raw)
I share my .zsh{env,rc} across several machines. On some, but not all, of
these machines, there exist certain files in other users' home directories;
files that, when they exist, I would like to reference from my .zsh{env,rc}.
*If* any of the users in question has an account on a machine, the file is
always found in the same place relative to his home directory. However,
the home directories themselves are not always in the same places. Thus I
would like to refer to these files as (e.g.) ~foo/fileX and ~bar/fileY.
Unfortunately, I normally use cshnullglob, which means that a reference to
the named directory ~foo is an error when foo is *not* a known user. So I
have to find out if foo is a user before I can reference ~foo. (There is
no equivalent of nullglob for file expansion, though nonomatch applies to
both filename expansion and filename generation.)
So, there are a couple of workarounds I can think of:
[[ -n "$(unsetopt cshnullglob; setopt nonomatch;
[[ -d ~foo ]] && echo ok)" ]]
Or:
[[ -n "$(hash -df ; hash -dm foo)" ]]
The latter is of course very poor when there are a large number of users.
Does anyone know a better way?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
reply other threads:[~1996-07-25 6:56 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=960724234411.ZM12007@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=schaefer@nbn.com \
--cc=zsh-users@math.gatech.edu \
/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).