scp not tolerant of extraneous shell messages

Thomas Binder binder at arago.de
Wed Jul 3 20:01:09 EST 2002


Hi!

On Tue, Jul 02, 2002 at 05:19:52PM -0700, Steve VanDevender wrote:
> .bashrc is read by any invocation of bash.

Nope. Quoting from bash's man page:

-- snip --
     When an interactive shell that  is  not  a  login  shell  is
     started, bash reads and executes commands from ~/.bashrc, if
     that file exists.  This may be inhibited by using the --norc
     option.   The  --rcfile  file option will force bash to read
     and execute commands from file instead of ~/.bashrc.

     When bash is  started  non-interactively,  to  run  a  shell
     script,  for  example, it looks for the variable BASH_ENV in
     the environment, expands its value if it appears there,  and
     uses  the  expanded  value as the name of a file to read and
     execute.  Bash behaves as if the following command were exe-
     cuted:
          if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
     but the value of the PATH variable is not used to search for
     the file name.
-- snap --

That's easily proved:

$ cat ~/.bashrc
echo This is from .bashrc

$ bash
This is from .bashrc

$ bash -c /bin/true
[No output]

> This is similar to the distinction between .login and .cshrc in
> csh.

Not quite. csh is the shell that /really/ reads its rc file even
for running commands via -c or executing hash bang scripts. But
not bash, nor ksh.


Ciao

Thomas



More information about the openssh-unix-dev mailing list