problem with environment detecting

Maxim Ryabenko maxy at rt.mipt.ru
Tue Mar 12 15:23:42 EST 2002


> The remote /etc/profile is not executed when you run a remote command
> using ssh.  Your remote echo appears to do what you want because
> variables get expanded inside double quotes.  Try it like this:
>
> 	ssh myhost 'echo $MYDIR'
>
> If you want the remote profile to be executed, you have to do something
> like this:
>
> 	ssh myhost '. /etc/profile; echo $MYDIR'
>
> Happy computing!
>
> Paul Allen

Thank you, Paul and Ben.

this is what I want,
ssh myhost '. /etc/profile; echo $MYDIR'  
It works good, thank you. 

Problem was not in standard command "echo". It was in my program (see prev. 
message).
This one works
.......
  if ((dir = getenv("MYDIR")) != NULL) 
.......
But this not
.......
  if ((dir = getenv("PATH")) != NULL) 
.......

It seems that there is another place (not /etc/profile), where environments 
PATH etc. are stored. But where?
Can I put my environment  there and do not run . /etc/profile like this:
ssh myhost '. /etc/profile;  ............'

Thank you so much!

p.s. sorry, my English is worst.
Maxim



More information about the openssh-unix-dev mailing list