[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
.bashrc is sourced even for non-interactive shells (when run from sshd)
From: |
Mikel Ward |
Subject: |
.bashrc is sourced even for non-interactive shells (when run from sshd) |
Date: |
Sat, 2 Jun 2012 10:15:16 -0700 |
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 || isnetconn (fileno (stdin)))
The man page says
When an interactive shell that is not a login shell is started,
bash reads and executes commands from ~/.bashrc,
but makes no mention of the special handling for ssh and rsh.
This seems to have been the case since at least bash 2.02.
I'd argue this is a misfeature, but I guess that ship has sailed. Can
the man page at least be updated?
Thanks
- .bashrc is sourced even for non-interactive shells (when run from sshd),
Mikel Ward <=
- 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, 2012/06/04
- 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