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

Reply via email to