delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/02/10/16:16:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,TW_CG,TW_YG,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
In-Reply-To: <20110210203553.GB32475@ednor.casa.cgf.cx>
References: <4D52A7DD DOT 7080208 AT bonhard DOT uklinux DOT net> <4D52B4D3 DOT 2040102 AT sbcglobal DOT net> <20110209163858 DOT GJ16194 AT calimero DOT vinschen DOT de> <0105D5C1E0353146B1B222348B0411A209C0F073A4 AT NIHMLBX02 DOT nih DOT gov> <4D541D35 DOT 3020901 AT redhat DOT com> <OF248AECF7 DOT EB384F53-ON85257833 DOT 006FBBCF-85257833 DOT 007007D2 AT lnotes-gw DOT ent DOT nwie DOT net> <20110210203553 DOT GB32475 AT ednor DOT casa DOT cgf DOT cx>
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: Re: Accessing folders elsewhere than C:\cygwin
X-KeepSent: 827A9B42:31F18336-85257833:0074A228; type=4; name=$KeepSent
Message-ID: <OF827A9B42.31F18336-ON85257833.0074A228-85257833.0074D338@lnotes-gw.ent.nwie.net>
From: RISINGP1 AT nationwide DOT com
Date: Thu, 10 Feb 2011 16:16:01 -0500
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

cygwin-owner wrote on 02/10/2011 03:35:53 PM:

> 
> On Thu, Feb 10, 2011 at 03:23:38PM -0500, RISINGP1 wrote:
> >Eric wrote on 02/10/2011 12:15:33 PM:
> >
> >> On 02/10/2011 10:13 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> >> > Might the ability to identify cygwin's root be a good
> >> > thing to add to cygpath?
> >> 
> >> And what's so hard about 'cygpath -w /'?
> >> 
> >> > Under "System information", one could have an option
> >> > 
> >> >   -R, --root    output cygwin root directory
> >> > 
> >> > where
> >> > 
> >> > $ cygpath -Rw
> >> > C:\cygwin
> >> 
> >> Trading / for -R doesn't justify the bloat and burning another short
> >> option character, in my opinion.
> >
> >If you need it ofetn enough, here is a simple script for displaying the 

> >cygwin root:
> >
> >case $1 in
> >    -w)
> >        mount | grep " / " | cut -d" " -f1 | sed 's:/:\\:g'
> >        ;;
> >    -u)
> >        DRIVE=$(mount | grep " / " | cut -d":" -f1):
> >        echo $(mount | grep "^$DRIVE " | \
> >        cut -d" " -f3)$(mount | grep " / " | cut -d" " -f1) | \
> >        sed 's/'$DRIVE'//'
> >        ;;
> >    *)
> >        echo "Please specify -w (Windows) or -u (Unix)"
> >        ;;
> >esac
> 
> Why would we need a simple script to display the cygwin root when
> "cygpath -w /" works fine?
> 
> cgf
> 

OK.  You are right (somehow I missed the "cygpath -w /" mention in the 
thread - oops).

Change

        -w)
               mount | grep " / " | cut -d" " -f1 | sed 's:/:\\:g'
               ;;

to

        -w)
               cygpath -w /
               ;;

But "cygpath -u /" will give "/" as an answer.  The script will give (for 
me) "/cygdrive/c/cygwin".

I was merely trying to offer an alternative to Barry's request for the 
"-R" option on cygpath.  Specifically, it answers this part of his 
request:

> $ cygpath -Ru
> /cygdrive/c/cygwin
> 
> or, if the cygdrive prefix has been changed to a simple /,
> 
> $ cygpath -Ru
> /c/cygwin

- Phil

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

- Raw text -


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