This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: [1.5.25-15] bash won't load .bashrc after i rename it as `sh.exe'.
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: cygwin at cygwin dot com
- Date: Sat, 11 Jul 2009 11:00:50 +0100
- Subject: Re: [1.5.25-15] bash won't load .bashrc after i rename it as `sh.exe'.
- References: <673dd2610907102107u30a8a29bx1109fdc6cfd77ea6@mail.gmail.com> <673dd2610907110244h6d6345f3tf74b8ba78c555559@mail.gmail.com>
chengxianle wrote:
> bash.exe loads my .bashrc in $HOME directory.
> But when i copy bash.exe as sh.exe, .bashrc won't be loaded.
> Rename as anything(like sh1.exe, sh2.exe, ...) except `sh.exe' works fine!
By design. Invoking bash as 'sh' enters special sh-compatibility mode.
See "info bash", section 6.2 Bash Startup Files:
> Invoked with name `sh'
> ......................
>
> If Bash is invoked with the name `sh', it tries to mimic the startup
> behavior of historical versions of `sh' as closely as possible, while
> conforming to the POSIX standard as well.
>
> When invoked as an interactive login shell, or as a non-interactive
> shell with the `--login' option, it first attempts to read and execute
> commands from `/etc/profile' and `~/.profile', in that order. The
> `--noprofile' option may be used to inhibit this behavior. When
> invoked as an interactive shell with the name `sh', Bash looks for the
> variable `ENV', expands its value if it is defined, and uses the
> expanded value as the name of a file to read and execute. Since a
> shell invoked as `sh' does not attempt to read and execute commands
> from any other startup files, the `--rcfile' option has no effect. A
> non-interactive shell invoked with the name `sh' does not attempt to
> read any other startup files.
>
> When invoked as `sh', Bash enters POSIX mode after the startup files
> are read.
cheers,
DaveK
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple