This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Programatically finding value of "cygdrive" prefix


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]