Cygwin home dir=/cygwin/c (not /home/<userid>)
Andrew DeFaria
ADeFaria@Salira.com
Mon Jan 13 02:54:00 GMT 2003
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/
More information about the Cygwin
mailing list