Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-04 Thread Steven W. Orr
On 6/4/2012 9:55 AM, Chet Ramey wrote: 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 som

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-04 Thread Chet Ramey
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 >

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-03 Thread Pierre Gaston
On Sun, Jun 3, 2012 at 11:02 AM, Linda Walsh wrote: > > > Pierre Gaston wrote: >> >> In all your examples the shell will be called like: bash -c  'isatty 0 >> 2'. If you use a bash compiled with the above option you can add 'ps >> -p$$ -ocmd' at the top of your .bashrc to verify it. >> >> They are

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-03 Thread Linda Walsh
Pierre Gaston wrote: In all your examples the shell will be called like: bash -c 'isatty 0 2'. If you use a bash compiled with the above option you can add 'ps -p$$ -ocmd' at the top of your .bashrc to verify it. They are all non-interactive because they are called with -c, disregarding if th

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Pierre Gaston
On Sun, Jun 3, 2012 at 3:05 AM, Linda Walsh wrote: > > > Pierre Gaston wrote: > >> On Sat, Jun 2, 2012 at 8:24 PM, Mikel Ward wrote: >>> >>> On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston >>> wrote: On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward wrote: > > bash sources .bashrc eve

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Linda Walsh
Pierre Gaston wrote: On Sat, Jun 2, 2012 at 8:24 PM, Mikel Ward wrote: On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston wrote: On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward wrote: bash sources .bashrc even for some non-interactive shells. ... "Remote non login non interactive shells" Bash h

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Pierre Gaston
On Sat, Jun 2, 2012 at 8:24 PM, Mikel Ward wrote: > On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston > wrote: >> On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward wrote: >>> bash sources .bashrc even for some non-interactive shells. > ... >> "Remote non login non interactive shells" >> Bash has a specia

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Mikel Ward
On Sat, Jun 2, 2012 at 10:19 AM, Pierre Gaston wrote: > On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward wrote: >> bash sources .bashrc even for some non-interactive shells. ... > "Remote non login non interactive shells" > Bash has a special compile time option that will cause it to source > the .bash

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Mikel Ward
Apologies. It's mentioned a few paragraphs further down. Can I suggest a change? How about instead of: When an interactive shell that is not a login shell is started something like: When a shell is started that is not a login shell, but is either an interactive shell or a networ

Re: .bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Pierre Gaston
On Sat, Jun 2, 2012 at 8:15 PM, Mikel Ward wrote: > bash sources .bashrc even for some non-interactive shells. > > For example with > >    echo \$- is $- > > in ~/.bashrc, and shell set to /bin/bash (bash 4.2.28) > >    ssh -n -T localhost true > > produces the output > >    $- is hBc > > I assume

.bashrc is sourced even for non-interactive shells (when run from sshd)

2012-06-02 Thread Mikel Ward
bash sources .bashrc even for some non-interactive shells. For example with echo \$- is $- in ~/.bashrc, and shell set to /bin/bash (bash 4.2.28) ssh -n -T localhost true produces the output $- is hBc I assume this is caused by this code in shell.c if (run_by_ssh || isnetco