This is the mail archive of the cygwin 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]

Re: /etc/profile always does a "cd $HOME"


On Sun, 22 May 2005, Sven Köhler wrote:

> Hi,
>
> i'd like to use cygwin from a normal windows-app. The problem is, that i
> need a login-shell, so that all environment-vars are properly set. The
> problem: bash -li always changes the current workdir!
>
> IMHO, executing "bash -li" shouldn't change the workdir.
> No other system i know does that. Script may rely on that behaviour.
>
> /etc/profile contains the like
>   cd "$HOME"
>
> That line cannot easily be removed. Starting the Cygwin-Link installed
> by the setup wouldn't cd to ~ anymore. This behaviours is liked by most
> users i guess (including my own).
>
> Any suggestions, how the situation could be improved?

Yes, you're correct in that on many Linux systems /etc/profile doesn't
change the working directory.  The directory is changed to $HOME by the
login process.

One possibility is adding a Cygwin-specific option to login(1) that would
log in as the current user without requiring the username to be specified
at the command line, to avoid local/domain username conflicts (e.g.,
"login -l") and skip printing the motd (as if .hushlogin is found).  If I
understand the security implications correctly, any user can log in as
herself without a password (using, for example, "login -f").  Then
cygwin.bat can be changed to use "login -lpf" instead of "bash -li".
This would simplify scripts like 'chere'.  It would also have the
advantage of using the users' favorite shell from /etc/passwd in console
logins.  Now, <http://cygwin.com/acronyms/#SHTDI>.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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]