[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: .bashrc is sourced even for non-interactive shells (when run from ss
From: |
Chet Ramey |
Subject: |
Re: .bashrc is sourced even for non-interactive shells (when run from sshd) |
Date: |
Mon, 04 Jun 2012 09:55:27 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 |
On 6/3/12 4:25 AM, Pierre Gaston wrote:
> I thought I was not documented (before 4 it was a bit less obvious
> to find the relevant bit) that's why I gave the link, but it is in
> fact documented.
> Eg in the bash 4 manual:
>
> Bash attempts to determine when it is being run with its
> standard input connected to a network connection, as when
> executed by the remote shell daemon, usually rshd, or the
> secure shell daemon sshd. If bash determines it is being
> run in this fashion, it reads and executes commands from
> ~/.bashrc and ~/.bashrc, if these files exist and are
> readable.
>
> If I'm not mistaken this feature is inherited from csh. I can
> guess some people are using it since there is this workaround
> testing for the SSH variables to make it work with openssh>5.
That's not exactly it, but the idea is right. isnetconn() (previously
issock()) has been around since bash-1.13. If I had to guess, I'd say
late August 1992 or 1993. It wasn't inherited from csh. The original
requests were along the lines of having something to set the remote
environment when running rsh or rcp. As you can see, this long predates
ssh.
As ssh became more popular, there were different ways to accomplish the
same thing (e.g., put BASH_ENV=startup-file into ~/.ssh/environment), but
there were still requests to leave the feature in bash. It's still there
today.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- .bashrc is sourced even for non-interactive shells (when run from sshd), Mikel Ward, 2012/06/02
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Pierre Gaston, 2012/06/02
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Mikel Ward, 2012/06/02
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Pierre Gaston, 2012/06/02
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Linda Walsh, 2012/06/02
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Pierre Gaston, 2012/06/02
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Linda Walsh, 2012/06/03
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Pierre Gaston, 2012/06/03
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd),
Chet Ramey <=
- Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Steven W. Orr, 2012/06/04
Re: .bashrc is sourced even for non-interactive shells (when run from sshd), Mikel Ward, 2012/06/02