public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Script to Auto CYGWIN -U all environment varialbes
@ 2011-02-07 22:36 Gary Furash
  2011-02-07 22:59 ` David Sastre
  2011-02-08 13:44 ` Andrew Schulman
  0 siblings, 2 replies; 3+ messages in thread
From: Gary Furash @ 2011-02-07 22:36 UTC (permalink / raw)
  To: cygwin

Has anyone written anything into their bash profile or whatever that goes
through each windows environment variable currently extant, and resets them
via CYGPATH

e.g.

Before, @ start of .bashrc
ETC=C:\WINDOWS\ETC

After run of .bashrc
ETC=`$(cygpath -u '$ETC')`; EXPORT ETC  (--> /cygpath/c/windows/etc)

Or something like that. So, by the time you hit your cygwin prompt all your
environment variables are already cleaned up.


Gary Furash | furashgary@gmail.com | 520-907-2470




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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Script to Auto CYGWIN -U all environment varialbes
  2011-02-07 22:36 Script to Auto CYGWIN -U all environment varialbes Gary Furash
@ 2011-02-07 22:59 ` David Sastre
  2011-02-08 13:44 ` Andrew Schulman
  1 sibling, 0 replies; 3+ messages in thread
From: David Sastre @ 2011-02-07 22:59 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]

On Mon, Feb 07, 2011 at 03:36:26PM -0700, Gary Furash wrote:
> Has anyone written anything into their bash profile or whatever that goes
> through each windows environment variable currently extant, and resets them
> via CYGPATH
> 
> Before, @ start of .bashrc
> ETC=C:\WINDOWS\ETC
> 
> After run of .bashrc
> ETC=`$(cygpath -u '$ETC')`; EXPORT ETC  (--> /cygpath/c/windows/etc)
> 
> Or something like that. So, by the time you hit your cygwin prompt all your
> environment variables are already cleaned up.

I have seen the need to take windows paths conversion into account only
when dealing with Java apps from within cygwin: e.g. a tomcat
appserver, where the catalina.sh converts cygwin paths into windows
ones before sending them to the JVM, that doesn't understand them.
Other than that, I fail to understand what is the use for this. 
Could you please elaborate on a use case for such a configuration?
Also note that, following your example, you can still reach
/cygpath/c/windows/etc without converting anything.

-- 
Huella de clave primaria: 0FDA C36F F110 54F4 D42B  D0EB 617D 396C 448B 31EB

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Script to Auto CYGWIN -U all environment varialbes
  2011-02-07 22:36 Script to Auto CYGWIN -U all environment varialbes Gary Furash
  2011-02-07 22:59 ` David Sastre
@ 2011-02-08 13:44 ` Andrew Schulman
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Schulman @ 2011-02-08 13:44 UTC (permalink / raw)
  To: cygwin

> Has anyone written anything into their bash profile or whatever that goes
> through each windows environment variable currently extant, and resets them
> via CYGPATH
> 
> e.g.
> 
> Before, @ start of .bashrc
> ETC=C:\WINDOWS\ETC
> 
> After run of .bashrc
> ETC=`$(cygpath -u '$ETC')`; EXPORT ETC  (--> /cygpath/c/windows/etc)
> 
> Or something like that. So, by the time you hit your cygwin prompt all your
> environment variables are already cleaned up.

Here's my solution.  Ugly quoting, but it works.

I chose to convert just a fixed list of environment variables that I know I
want to convert.  I guess it would be easy to cycle through all environment
variables and 'bashify' any that look like paths, i.e. any that have
backslashes in them.

    # Convert Win32-style paths to Cygwin-style
    function bashify {
        local p
        for p ; do
            if [ "${!p}" ] ; then
                eval 'export '$p'=$(cygpath -pu "$'$p'")'
            fi
        done
    }
    bashify MSDEV PROGRAMFILES WINDIR


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-08 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 22:36 Script to Auto CYGWIN -U all environment varialbes Gary Furash
2011-02-07 22:59 ` David Sastre
2011-02-08 13:44 ` Andrew Schulman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).