delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/03/12:21:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
To: cygwin AT cygwin DOT com
Path: not-for-mail
From: Andrew DeFaria <ADeFaria AT Salira DOT com>
Subject: Re: Cygwin home dir=/cygwin/c (not /home/<userid>)
Date: Fri, 03 Jan 2003 09:19:10 -0800
Lines: 32
Message-ID: <3E15C60E.5090408@Salira.com>
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0301021341260 DOT 8991-100000 AT slinky DOT cs DOT nyu DOT edu> <3E14B9ED DOT 2318E8C9 AT swipnet DOT se> <20030102222853 DOT GA313905 AT WORLDNET> <3E15C121 DOT 77213232 AT swipnet DOT se>
Mime-Version: 1.0
X-Complaints-To: usenet AT main DOT gmane DOT org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01
X-Accept-Language: en-us, en, ru, zh

a12 wrote:

> Pierre,
>
> 'echo %HOME%' yields 'C:\'
>
> Modifying /etc/profile:
> # Set up USER's home directory
> # 020102 magr40 force to use /home/$USER
> #if [ -z "$HOME" ]; then
> HOME="/home/$USER"
> #fi
> solves my problem, but is it the correct way to do it ?
>
My solution is the following:

HOME=`grep ^$USER: /etc/passwd | cut -f6 -d:`
SHELL=`grep ^$USER: /etc/passwd | cut -f7 -d:`

# Set up USER's home directory
if [ -z "$HOME" ]; then
  echo "WARNING: HOME not set! Defaulting to /home/$USER."
  HOME="/home/$USER"
fi

if [ ! -d "$HOME" ]; then
  echo "WARNING: HOME directory did not exist! Logging in with HOME = /tmp"
  HOME="/tmp"
fi

This sets HOME and SHELL as per /etc/passwd, which, IMHO, is better.




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019