delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/06/16:52:28

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <409AA535.8080802@pobox.com>
Date: Thu, 06 May 2004 13:51:01 -0700
From: Tim Shadel <timshadel AT pobox DOT com>
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Subject: Re: sshd, plink, bash and path problems
References: <40999B63 DOT 8080305 AT pobox DOT com> <6 DOT 1 DOT 0 DOT 6 DOT 0 DOT 20040505221846 DOT 031cf5c0 AT 127 DOT 0 DOT 0 DOT 1> <409A7C79 DOT 1000006 AT pobox DOT com> <Pine DOT GSO DOT 4 DOT 56 DOT 0405061404430 DOT 7684 AT slinky DOT cs DOT nyu DOT edu>
In-Reply-To: <Pine.GSO.4.56.0405061404430.7684@slinky.cs.nyu.edu>

Igor Pechtchanski wrote:

>Why not try it locally, like this:
>
>echo echo $PATH
>echo 'echo $PATH'
>echo "echo $PATH"
>
>and then
>
>sh -xc 'PATH=/blah;echo $PATH'
>sh -xc "PATH=/blah;echo $PATH"
>

Aah.  I forgot about the meanings of various quotes in bash.  That's an 
excellent example.

>>>2. Is there a file (.rc something-or-other perhaps?) that I can create
>>>that will make the "source /etc/profile" call once plink connects, so I
>>>can have the right path when <command> happens?
>>>      
>>>
>
>Well, you can tell ssh to invoke a login shell (e.g., "ssh a AT b bash -l -c
>'commands'").  I don't know about plink.
>

plink also allows commands to be run.  That "bash -l -c 'commands'" 
works great.  I see if there's any way to change the code to use it, but 
that solves my problem.

>>Can I change the cygwin environment (server side) to handle both (a) and
>>(b) in the same way?
>>    
>>
>
>No.  If you run the above experiments, you'll see why.
>

Yup.  Thanks.

>This has nothing to do with Cygwin.  This is pure shell stuff.
>  
>

I guess I didn't know the original PATH was the windows one.  That makes 
more sense now.  So I'd see the same thing on a Linux box using pure 
ssh.  If the PATH were changed by /etc/profile, and I didn't use the 
"bash -l -c 'commands'" stuff to force a bash login, then I wouldn't see 
the new PATH there either.

I assume that the only way to 'source /etc/profile' requires a change to 
the content after "ssh a AT b".  For example, '"ssh a AT b bash -l -c 
'commands'" and "ssh a AT b source /etc/profile; commands" both work for 
me.  I only wish I could "ssh a AT b commands" and have it work.  I've got 
the info I need to figure out a different solution, though.  Thanks!

>HTH,
>	Igor
>  
>

It helps immensely.  Thank you very much.

Tim

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019