Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Michael Schaap 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/