delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/11/06:25:55

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Tue, 11 Sep 2001 11:25:23 +0100
Message-ID: <2617-Tue11Sep2001112523+0100-starksb@ebi.ac.uk>
X-Mailer: emacs 20.7.1 (via feedmail 9-beta-7 I);
VM 6.92 under Emacs 20.7.1
From: David Starks-Browning <starksb AT ebi DOT ac DOT uk>
MIME-Version: 1.0
To: Michael Schaap <cygwin AT mscha DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: output allowed in .bashrc and .tcshrc (Was: Virus Found)
In-Reply-To: <5.1.0.14.2.20010911120619.00acb4a8@imap.local.mscha.com>
References: <20010911111946 DOT A1285 AT cygbert DOT vinschen DOT de>
<20010911004146 DOT H937 AT cygbert DOT vinschen DOT de>
<8F23E55D511AD5119A6800D0B76FDDE101A26A59 AT cpex3 DOT channelpoint DOT com>
<59jqpt4f25eochmtlslvv9nodngnkeeo3d AT 4ax DOT com>
<5 DOT 1 DOT 0 DOT 14 DOT 2 DOT 20010911020929 DOT 00ac0fc0 AT imap DOT local DOT mscha DOT com>
<5 DOT 1 DOT 0 DOT 14 DOT 2 DOT 20010911120619 DOT 00acb4a8 AT imap DOT local DOT mscha DOT com>

On Tuesday 11 Sep 01, Michael Schaap writes:
> Even .bashrc is only supposed to be called on interactive shells.  (Unless 
> BASH_ENV = "$HOME/.bashrc" which it really shouldn't, but seems to be 
> commonly done.)
> Unfortunately, both "ssh machine command" and "scp ..." _do_ run 
> .bashrc.  I have no idea why, since
>          ssh machine 'echo $-'
> shows that it is really a non-interactive shell.

It must be this, from the bash(1) man page:

       Bash  attempts  to  determine  when it is being run by the
       remote shell daemon, usually rshd.  If bash determines  it
       is  being run by rshd, it reads and executes commands from
       ~/.bashrc, if that file exists and is readable.   ...

So the observed behavior is documented, with sshd in place of rshd.

> The documented way for Bash to check if a shell is interactive is by 
> checking if $- contains 'i'.  For example:
>          if [[ $- = *i* ]] ; then
>              echo Interactive
>          fi

Thanks for the lesson!

Cheers,
David


--
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/

- Raw text -


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