From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id QAA05482 for ; Thu, 25 Jul 1996 16:56:14 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id CAA18500; Thu, 25 Jul 1996 02:44:59 -0400 (EDT) Resent-Date: Thu, 25 Jul 1996 02:43:08 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960724234411.ZM12007@candle.brasslantern.com> Date: Wed, 24 Jul 1996 23:44:11 -0700 Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.702 02jul96) To: zsh-users@math.gatech.edu Subject: Determining whether a user name is valid MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"RBUpZ3.0.TW4.xTnzn"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/335 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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"