On Sat, 07 May 2011 11:09:08 +0200
Pieter Praet <[email protected]> wrote:

> On Thu, 5 May 2011 18:22:24 +0200, Dieter Plaetinck <[email protected]> 
> wrote:
> > On Thu, 05 May 2011 18:15:09 +0200
> > Pieter Praet <[email protected]> wrote:
> > 
> > > Very odd.
> > > 
> > > I'm beginning to doubt whether your .bashrc is even being sourced.
> > > 
> > > 
> > > Could you try adding to your remote .bashrc:
> > >   export testvar="something"
> > > 
> > > And run locally:
> > >   ssh user@remote "echo \$testvar"
> > > 
> > > 
> > > That should most definitely return a nonzero length string.
> > 
> > 18:16:34 dieter@Gi ~ ssh dieter-linode1 # the remote    
> > Last login: Thu May  5 18:16:13 2011 from 157.193.135.93
> > bash profile
> > bashrc
> > [dieter@dieter-linode1 ~]$ head -n 2 .bashrc 
> > export testvar="something"
> > echo bashrc before interactive check
> > [dieter@dieter-linode1 ~]$ logout
> > Connection to dieter-linode1 closed.
> > 18:16:31 dieter@Gi ~ ssh dieter-linode1 "echo \$testvar" # zsh on my local 
> > machine..
> > 
> > 18:17:07 dieter@Gi ~ bash
> > [dieter@gibran ~]$ ssh dieter-linode1 "echo \$testvar" # just to be really 
> > sure: same result with bash..
> > 
> > [dieter@gibran ~]$
> > 
> > 
> > 
> > maybe you have something in your /etc/bash* that causes incorrect sourcing, 
> > whereas I don't?
> 
> I'd go as far as claiming the inverse is true :D
> 
> The Bash manpages [1] clearly state:
> >> Invoked by remote shell daemon
> >>   Bash attempts to determine when it is being run with its standard
> >>   input connected to a a network connection, as if 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, if that file exists and is
> >>   readable. It will not do this if invoked as sh. The --norc option
> >>   may be used to inhibit this behavior, and the --rcfile option may
> >>   be used to force another file to be read, but rshd does not
> >>   generally invoke the shell with those options or allow them to be
> >>   specified.
> 
> If, for some obscure reason, Bash wouldn't be able to detect that it's
> been invoked by SSH, .bashrc would still be sourced by .bash_profile [2].
> 
> Also, many discussions [3,4] attest to the fact ~/.bashrc *should*
> normally get sourced, irrespective of whether it's a login shell,
> irrespective of whether it's interactive.
> 
> And as Arch tries very hard (and succeeds) to ferociously abolish
> pointless crap as a matter of principle [5], it'd be very surprised if
> they'd have dropped the ball on Bash of all things. Both the skel [6] as
> well as the system-wide [7] bashrc explicitly check whether they're
> being run interactively.
> 
> > Dieter
> > 
> > 
> > 
> > -- 
> > To unsubscribe, send mail to [email protected].
> 
> 
> Peace
> 

okay, i have the interactivity check in /etc/skel/.bashrc, and after an update, 
i get it also in /etc/bash.bashrc (so the interactivity check in the latter is 
actually fairly new)

but this does not change the fact that when I `ssh dieter-linode1
"echo \$testvar"` I only get an empty line. (whereas `echo $testvar` works when 
I login regularly)

I'm confused.

Dieter

-- 
To unsubscribe, send mail to [email protected].

Reply via email to