This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: System environment variables


On Aug 24 14:27, Jason Pyeron wrote:
> On Wed, 24 Aug 2005, Corinna Vinschen wrote:
> 
> >On Aug 24 13:08, Jason Pyeron wrote:
> >>
> >>
> >>How can I get the ssh service to inherit the environment variables as set
> >>in the system properties control panel applet?
> >
> >You can't.  Use one of the methods to propagate environment variables
> 
> thats what I thought.
> 
> can I get some comments and critiques on my solution below:
> 
> 
> /etc/profile.d/winvars.sh
> 
> 
> #! /bin/sh
> 
> cd 
> /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\ 
> Manager/Environment/
> 
> for i in * ; do
> 
>  bash -c "set -u ; echo \$$i" 2&> /dev/null || export $i="`cat $i`"
> 
> done

Basically a good idea, but it probably won't work for two reasons.

- Some of the env variables in the registry are REG_EXPAND_SZ strings which
  contain other variables like this:

     %SystemRoot%\System32

  These strings have to be expanded before they are usable as real env
  strings.

- The output of cat isn't quoted, so you will probably get wrong results
  when backslashes are used like above.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]