Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Tue, 16 Aug 2005 17:46:55 -0400
From: Christopher Faylor <cgf-no-personal-reply-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Programatically finding value of "cygdrive" prefix
Message-ID: <20050816214654.GA18585@trixie.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
References: <42FA4604.8000507@tlinx.org> <20050810183616.GA5892@trixie.casa.cgf.cx> <Pine.GSO.4.61.0508152130380.9560@slinky.cs.nyu.edu> <1124222681.29974.37.camel@p450> <Pine.GSO.4.61.0508161649420.9560@slinky.cs.nyu.edu> <20050816212826.GG16323@trixie.casa.cgf.cx>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20050816212826.GG16323@trixie.casa.cgf.cx>
User-Agent: Mutt/1.5.8i

On Tue, Aug 16, 2005 at 05:28:26PM -0400, Christopher Faylor wrote:
>On Tue, Aug 16, 2005 at 05:10:25PM -0400, Igor Pechtchanski wrote:
>>There may not be a C: drive, but "cygpath -u c:" will do the right thing
>>-- try it with a drive you don't have.
>
>  mount -f c: /willthisthreadeverdie
>  cygpath -u c:
>  /willthisthreadeverdie

In the spirit of my other contribution, here's the fix for the above
problem:

    #!/bin/bash
    mount -m > /tmp/saveme.$$
    eval `sed -nre '/"[a-zA-Z]:"/s/^mount\s.*("[^"]*")\s".*$/umount \1;/p' /tmp/saveme.$$`
    echo $(dirname $(cygpath -u c:))
    eval `sed -nre '/"[a-zA-Z]:"/s/^.*$/&;/p' /tmp/saveme.$$`
    . /tmp/saveme.$$
    rm /tmp/saveme.$$

I think this one is slightly faster than my previous attempt.

cgf

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

