This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |