| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,KHOP_RCVD_UNTRUST,KHOP_THREADED,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,TW_YG |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <20130223185105.3960@binki> |
| Date: | Sat, 23 Feb 2013 18:51:05 +1000 |
| From: | wynfield AT gmail DOT com |
| To: | <cygwin AT cygwin DOT com> |
| Subject: | Re: $USER is not resolved in paths sometimes |
| In-reply-to: | Your message of Sat, 23 Feb 2013 09:24:32 +1000 <20130223092432.2564@binki> |
| References: | <kg8pct$bnq$1 AT ger DOT gmane DOT org> <20130223092432 DOT 2564 AT binki> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 |
Sorry, I copied all examples with the -w option which is wrong for converting into a unix like pathname.
To convert to a unix pathname use the option -u
to convert to a windows pathname use -w
Run: cygpath --help
for more detals. and to get the output in the sell use $(...) or the ticks `....`
with the command and all arguments inside.
>
> I agree with Achim. Don't use Microsoft Windows paths.
> Cygwin has a function called cygpath which is very handy to use to convert paths and use in zsh and other shell scripts
>
> In zsh, using zsh syntax, I use it like this:
>
> Convert the first argument to a micrsoft window format pathname
> winpath=$(cygpath -w $1)
>
> or to convert a Windows formatted pathname to unix like do:
> fname=$(cygpath -w ${windows-type-ifname})
>
> a hardcoded filename would be
> fname=$(cygpath -w ${C:\miscrosoft\windows-type-ifname.abc})
>
> * you may need to quote the flename to escape : or \....
>
--
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 |