| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD |
| X-Spam-Check-By: | sourceware.org |
| To: | cygwin AT cygwin DOT com |
| From: | Andrew Schulman <schulman DOT andrew AT epamail DOT epa DOT gov> |
| Subject: | Re: Script to Auto CYGWIN -U all environment varialbes |
| Date: | Tue, 08 Feb 2011 08:44:31 -0500 |
| Lines: | 32 |
| Message-ID: | <qhh2l6dstmdp8s9a9usp1sgeki5sotrtnv@4ax.com> |
| References: | <011c01cbc717$766ecfe0$634c6fa0$@com> |
| Mime-Version: | 1.0 |
| X-Archive: | encrypt |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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 |
> 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |