delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/11/05:48:24

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_84,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A5862D2.4050707@gmail.com>
Date: Sat, 11 Jul 2009 11:00:50 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [1.5.25-15] bash won't load .bashrc after i rename it as `sh.exe'.
References: <673dd2610907102107u30a8a29bx1109fdc6cfd77ea6 AT mail DOT gmail DOT com> <673dd2610907110244h6d6345f3tf74b8ba78c555559 AT mail DOT gmail DOT com>
In-Reply-To: <673dd2610907110244h6d6345f3tf74b8ba78c555559@mail.gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

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

- Raw text -


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